├── .editorconfig ├── .gitattributes ├── .github └── workflows │ └── test.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin └── install-wp-tests.sh ├── composer.json ├── composer.lock ├── phpcs.xml ├── phpunit.xml ├── src └── Response.php └── tests ├── bootstrap.php └── test-response.php /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | indent_style = tab 9 | 10 | [{*.txt,wp-config-sample.php}] 11 | end_of_line = crlf 12 | 13 | [*.yml] 14 | indent_style = space 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | PHPCS: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v2 11 | - name: Install dependencies 12 | run: composer install --no-progress 13 | - name: Coding Standards 14 | run: composer phpcs 15 | PHPUnit: 16 | runs-on: ubuntu-latest 17 | strategy: 18 | matrix: 19 | php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v2 23 | - name: Install dependencies 24 | run: composer install --no-progress 25 | - name: PHPUnit 26 | run: | 27 | composer setup-local-tests 28 | composer phpunit 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Project ### 2 | *.log 3 | /vendor/ 4 | 5 | ### Windows ### 6 | # Windows image file caches 7 | Thumbs.db 8 | ehthumbs.db 9 | 10 | # Folder config file 11 | Desktop.ini 12 | 13 | # Recycle Bin used on file shares 14 | $RECYCLE.BIN/ 15 | 16 | # Windows Installer files 17 | *.cab 18 | *.msi 19 | *.msm 20 | *.msp 21 | 22 | # Windows shortcuts 23 | *.lnk 24 | 25 | 26 | ### macOS ### 27 | *.DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Icon must end with two \r 32 | Icon 33 | 34 | 35 | # Thumbnails 36 | ._* 37 | 38 | # Files that might appear in the root of a volume 39 | .DocumentRevisions-V100 40 | .fseventsd 41 | .Spotlight-V100 42 | .TemporaryItems 43 | .Trashes 44 | .VolumeIcon.icns 45 | .com.apple.timemachine.donotpresent 46 | 47 | # Directories potentially created on remote AFP share 48 | .AppleDB 49 | .AppleDesktop 50 | Network Trash Folder 51 | Temporary Items 52 | .apdisk 53 | 54 | 55 | ### Sass ### 56 | .sass-cache/ 57 | *.css.map 58 | 59 | 60 | ### SublimeText ### 61 | # cache files for sublime text 62 | *.tmlanguage.cache 63 | *.tmPreferences.cache 64 | *.stTheme.cache 65 | 66 | # workspace files are user-specific 67 | *.sublime-workspace 68 | .vscode 69 | 70 | # project files should be checked into the repository, unless a significant 71 | # proportion of contributors will probably not be using SublimeText 72 | # *.sublime-project 73 | 74 | # sftp configuration file 75 | sftp-config.json 76 | 77 | # postcss sorting config file 78 | settings.json 79 | 80 | # Package control specific files 81 | Package Control.last-run 82 | Package Control.ca-list 83 | Package Control.ca-bundle 84 | Package Control.system-ca-bundle 85 | Package Control.cache/ 86 | Package Control.ca-certs/ 87 | bh_unicode_properties.cache 88 | 89 | # Sublime-github package stores a github token in this file 90 | # https://packagecontrol.io/packages/sublime-github 91 | GitHub.sublime-settings 92 | 93 | 94 | ### Vim ### 95 | # swap 96 | [._]*.s[a-w][a-z] 97 | [._]s[a-w][a-z] 98 | # session 99 | Session.vim 100 | # temporary 101 | .netrwhist 102 | *~ 103 | # auto-generated tag files 104 | tags 105 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## 1.0.1 - 11.02.2020 5 | 6 | ### Fixed 7 | - Success message not being passed to output. 8 | 9 | ## 1.0.0 - 10.02.2020 10 | 11 | Initial release 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ajax 2 | 3 | [![BracketSpace Micropackage](https://img.shields.io/badge/BracketSpace-Micropackage-brightgreen)](https://bracketspace.com) 4 | [![Latest Stable Version](https://poser.pugx.org/micropackage/ajax/v/stable)](https://packagist.org/packages/micropackage/ajax) 5 | [![PHP from Packagist](https://img.shields.io/packagist/php-v/micropackage/ajax.svg)](https://packagist.org/packages/micropackage/ajax) 6 | [![Total Downloads](https://poser.pugx.org/micropackage/ajax/downloads)](https://packagist.org/packages/micropackage/ajax) 7 | [![License](https://poser.pugx.org/micropackage/ajax/license)](https://packagist.org/packages/micropackage/ajax) 8 | 9 |

10 | Micropackage logo 11 |

12 | 13 | ## 🧬 About Ajax 14 | 15 | This micropackage is a wrapper for WordPress AJAX responses in PHP. 16 | 17 | ## 💾 Installation 18 | 19 | ``` bash 20 | composer require micropackage/ajax 21 | ``` 22 | 23 | ## 🕹 Usage 24 | 25 | ### Basic usage 26 | 27 | ```php 28 | use Micropackage\Ajax\Response; 29 | 30 | function ajax_action_handler() { 31 | $response = new Response(); 32 | 33 | // Handle nonce. 34 | $response->verify_nonce( $action = 'my_action', $query_arg = 'noncefield', $send_if_failed = true ); 35 | 36 | // Do some checks and immediately send an error. 37 | if ( something_is_wrong() ) { 38 | $response->error( 'Error message' ); 39 | } 40 | 41 | // This is never reached. 42 | $response->send( 'All good' ); 43 | 44 | } 45 | ``` 46 | 47 | ### Error collecting 48 | 49 | You can collect multiple errors in one response. 50 | 51 | ```php 52 | use Micropackage\Ajax\Response; 53 | 54 | function ajax_action_handler() { 55 | $response = new Response(); 56 | 57 | // Do some checks. 58 | if ( something_is_wrong() ) { 59 | $response->add_error( 'Error message' ); 60 | } 61 | 62 | // Do some checks. 63 | if ( something_else_is_wrong() ) { 64 | $response->add_error( 'Whoah!' ); 65 | } 66 | 67 | // If no error added, the below message will be sent. 68 | $response->send( 'All good if no errors' ); 69 | 70 | } 71 | ``` 72 | 73 | ### Sending data 74 | 75 | ```php 76 | use Micropackage\Ajax\Response; 77 | 78 | function ajax_action_handler() { 79 | $response = new Response(); 80 | $response->send( $data_array ); 81 | } 82 | ``` 83 | 84 | ## 📦 About the Micropackage project 85 | 86 | Micropackages - as the name suggests - are micro packages with a tiny bit of reusable code, helpful particularly in WordPress development. 87 | 88 | The aim is to have multiple packages which can be put together to create something bigger by defining only the structure. 89 | 90 | Micropackages are maintained by [BracketSpace](https://bracketspace.com). 91 | 92 | ## 📖 Changelog 93 | 94 | [See the changelog file](./CHANGELOG.md). 95 | 96 | ## 📃 License 97 | 98 | GNU General Public License (GPL) v3.0. See the [LICENSE](./LICENSE) file for more information. 99 | -------------------------------------------------------------------------------- /bin/install-wp-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ $# -lt 3 ]; then 4 | echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" 5 | exit 1 6 | fi 7 | 8 | DB_NAME=$1 9 | DB_USER=$2 10 | DB_PASS=$3 11 | DB_HOST=${4-localhost} 12 | WP_VERSION=${5-latest} 13 | SKIP_DB_CREATE=${6-false} 14 | 15 | TMPDIR=${TMPDIR-/tmp} 16 | TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") 17 | WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} 18 | WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} 19 | 20 | download() { 21 | if [ `which curl` ]; then 22 | curl -s "$1" > "$2"; 23 | elif [ `which wget` ]; then 24 | wget -nv -O "$2" "$1" 25 | fi 26 | } 27 | 28 | if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then 29 | WP_TESTS_TAG="branches/$WP_VERSION" 30 | elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then 31 | if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then 32 | # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x 33 | WP_TESTS_TAG="tags/${WP_VERSION%??}" 34 | else 35 | WP_TESTS_TAG="tags/$WP_VERSION" 36 | fi 37 | elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then 38 | WP_TESTS_TAG="trunk" 39 | else 40 | # http serves a single offer, whereas https serves multiple. we only want one 41 | download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json 42 | grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json 43 | LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') 44 | if [[ -z "$LATEST_VERSION" ]]; then 45 | echo "Latest WordPress version could not be found" 46 | exit 1 47 | fi 48 | WP_TESTS_TAG="tags/$LATEST_VERSION" 49 | fi 50 | 51 | set -ex 52 | 53 | install_wp() { 54 | 55 | if [ -d $WP_CORE_DIR ]; then 56 | return; 57 | fi 58 | 59 | mkdir -p $WP_CORE_DIR 60 | 61 | if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then 62 | mkdir -p $TMPDIR/wordpress-nightly 63 | download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip 64 | unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ 65 | mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR 66 | else 67 | if [ $WP_VERSION == 'latest' ]; then 68 | local ARCHIVE_NAME='latest' 69 | elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then 70 | # https serves multiple offers, whereas http serves single. 71 | download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json 72 | if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then 73 | # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x 74 | LATEST_VERSION=${WP_VERSION%??} 75 | else 76 | # otherwise, scan the releases and get the most up to date minor version of the major release 77 | local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` 78 | LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) 79 | fi 80 | if [[ -z "$LATEST_VERSION" ]]; then 81 | local ARCHIVE_NAME="wordpress-$WP_VERSION" 82 | else 83 | local ARCHIVE_NAME="wordpress-$LATEST_VERSION" 84 | fi 85 | else 86 | local ARCHIVE_NAME="wordpress-$WP_VERSION" 87 | fi 88 | download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz 89 | tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR 90 | fi 91 | 92 | download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php 93 | } 94 | 95 | install_test_suite() { 96 | # portable in-place argument for both GNU sed and Mac OSX sed 97 | if [[ $(uname -s) == 'Darwin' ]]; then 98 | local ioption='-i .bak' 99 | else 100 | local ioption='-i' 101 | fi 102 | 103 | # set up testing suite if it doesn't yet exist 104 | if [ ! -d $WP_TESTS_DIR ]; then 105 | # set up testing suite 106 | mkdir -p $WP_TESTS_DIR 107 | svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes 108 | svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data 109 | fi 110 | 111 | if [ ! -f wp-tests-config.php ]; then 112 | download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php 113 | # remove all forward slashes in the end 114 | WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") 115 | sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php 116 | sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php 117 | sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php 118 | sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php 119 | sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php 120 | fi 121 | 122 | } 123 | 124 | install_db() { 125 | 126 | if [ ${SKIP_DB_CREATE} = "true" ]; then 127 | return 0 128 | fi 129 | 130 | # parse DB_HOST for port or socket references 131 | local PARTS=(${DB_HOST//\:/ }) 132 | local DB_HOSTNAME=${PARTS[0]}; 133 | local DB_SOCK_OR_PORT=${PARTS[1]}; 134 | local EXTRA="" 135 | 136 | if ! [ -z $DB_HOSTNAME ] ; then 137 | if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then 138 | EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" 139 | elif ! [ -z $DB_SOCK_OR_PORT ] ; then 140 | EXTRA=" --socket=$DB_SOCK_OR_PORT" 141 | elif ! [ -z $DB_HOSTNAME ] ; then 142 | EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" 143 | fi 144 | fi 145 | 146 | # create database 147 | mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA 148 | } 149 | 150 | install_wp 151 | install_test_suite 152 | install_db 153 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "micropackage/ajax", 3 | "description": "Wrapper for WordPress' AJAX", 4 | "license": "GPL-3.0-or-later", 5 | "authors": [ 6 | { 7 | "name": "Jakub Mikita", 8 | "email": "jakub@bracketspace.com" 9 | } 10 | ], 11 | "scripts": { 12 | "phpcs": "phpcs", 13 | "phpcbf": "phpcbf", 14 | "phpunit": "phpunit", 15 | "phpunit-coverage": "phpunit --coverage-text", 16 | "setup-local-tests": "bash bin/install-wp-tests.sh wordpress_test root root localhost latest" 17 | }, 18 | "require": { 19 | "php": ">=5.6" 20 | }, 21 | "require-dev": { 22 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", 23 | "phpcompatibility/php-compatibility": "^9.1", 24 | "wp-coding-standards/wpcs": "^2.0", 25 | "phpunit/phpunit": "^6.5.5", 26 | "php-mock/php-mock-phpunit": "^2.6" 27 | }, 28 | "autoload": { 29 | "psr-4" : { 30 | "Micropackage\\Ajax\\" : "src" 31 | } 32 | }, 33 | "autoload-dev": { 34 | "psr-4" : { 35 | "Micropackage\\Ajax\\Test\\" : "tests" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "c6eb9db51d15537436a981c5765c1f55", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "dealerdirect/phpcodesniffer-composer-installer", 12 | "version": "v0.5.0", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", 16 | "reference": "e749410375ff6fb7a040a68878c656c2e610b132" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132", 21 | "reference": "e749410375ff6fb7a040a68878c656c2e610b132", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "composer-plugin-api": "^1.0", 26 | "php": "^5.3|^7", 27 | "squizlabs/php_codesniffer": "^2|^3" 28 | }, 29 | "require-dev": { 30 | "composer/composer": "*", 31 | "phpcompatibility/php-compatibility": "^9.0", 32 | "sensiolabs/security-checker": "^4.1.0" 33 | }, 34 | "type": "composer-plugin", 35 | "extra": { 36 | "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" 41 | } 42 | }, 43 | "notification-url": "https://packagist.org/downloads/", 44 | "license": [ 45 | "MIT" 46 | ], 47 | "authors": [ 48 | { 49 | "name": "Franck Nijhof", 50 | "email": "franck.nijhof@dealerdirect.com", 51 | "homepage": "http://www.frenck.nl", 52 | "role": "Developer / IT Manager" 53 | } 54 | ], 55 | "description": "PHP_CodeSniffer Standards Composer Installer Plugin", 56 | "homepage": "http://www.dealerdirect.com", 57 | "keywords": [ 58 | "PHPCodeSniffer", 59 | "PHP_CodeSniffer", 60 | "code quality", 61 | "codesniffer", 62 | "composer", 63 | "installer", 64 | "phpcs", 65 | "plugin", 66 | "qa", 67 | "quality", 68 | "standard", 69 | "standards", 70 | "style guide", 71 | "stylecheck", 72 | "tests" 73 | ], 74 | "time": "2018-10-26T13:21:45+00:00" 75 | }, 76 | { 77 | "name": "doctrine/instantiator", 78 | "version": "1.3.0", 79 | "source": { 80 | "type": "git", 81 | "url": "https://github.com/doctrine/instantiator.git", 82 | "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" 83 | }, 84 | "dist": { 85 | "type": "zip", 86 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", 87 | "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", 88 | "shasum": "" 89 | }, 90 | "require": { 91 | "php": "^7.1" 92 | }, 93 | "require-dev": { 94 | "doctrine/coding-standard": "^6.0", 95 | "ext-pdo": "*", 96 | "ext-phar": "*", 97 | "phpbench/phpbench": "^0.13", 98 | "phpstan/phpstan-phpunit": "^0.11", 99 | "phpstan/phpstan-shim": "^0.11", 100 | "phpunit/phpunit": "^7.0" 101 | }, 102 | "type": "library", 103 | "extra": { 104 | "branch-alias": { 105 | "dev-master": "1.2.x-dev" 106 | } 107 | }, 108 | "autoload": { 109 | "psr-4": { 110 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 111 | } 112 | }, 113 | "notification-url": "https://packagist.org/downloads/", 114 | "license": [ 115 | "MIT" 116 | ], 117 | "authors": [ 118 | { 119 | "name": "Marco Pivetta", 120 | "email": "ocramius@gmail.com", 121 | "homepage": "http://ocramius.github.com/" 122 | } 123 | ], 124 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 125 | "homepage": "https://www.doctrine-project.org/projects/instantiator.html", 126 | "keywords": [ 127 | "constructor", 128 | "instantiate" 129 | ], 130 | "time": "2019-10-21T16:45:58+00:00" 131 | }, 132 | { 133 | "name": "myclabs/deep-copy", 134 | "version": "1.9.5", 135 | "source": { 136 | "type": "git", 137 | "url": "https://github.com/myclabs/DeepCopy.git", 138 | "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" 139 | }, 140 | "dist": { 141 | "type": "zip", 142 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", 143 | "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", 144 | "shasum": "" 145 | }, 146 | "require": { 147 | "php": "^7.1" 148 | }, 149 | "replace": { 150 | "myclabs/deep-copy": "self.version" 151 | }, 152 | "require-dev": { 153 | "doctrine/collections": "^1.0", 154 | "doctrine/common": "^2.6", 155 | "phpunit/phpunit": "^7.1" 156 | }, 157 | "type": "library", 158 | "autoload": { 159 | "psr-4": { 160 | "DeepCopy\\": "src/DeepCopy/" 161 | }, 162 | "files": [ 163 | "src/DeepCopy/deep_copy.php" 164 | ] 165 | }, 166 | "notification-url": "https://packagist.org/downloads/", 167 | "license": [ 168 | "MIT" 169 | ], 170 | "description": "Create deep copies (clones) of your objects", 171 | "keywords": [ 172 | "clone", 173 | "copy", 174 | "duplicate", 175 | "object", 176 | "object graph" 177 | ], 178 | "time": "2020-01-17T21:11:47+00:00" 179 | }, 180 | { 181 | "name": "phar-io/manifest", 182 | "version": "1.0.1", 183 | "source": { 184 | "type": "git", 185 | "url": "https://github.com/phar-io/manifest.git", 186 | "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" 187 | }, 188 | "dist": { 189 | "type": "zip", 190 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", 191 | "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", 192 | "shasum": "" 193 | }, 194 | "require": { 195 | "ext-dom": "*", 196 | "ext-phar": "*", 197 | "phar-io/version": "^1.0.1", 198 | "php": "^5.6 || ^7.0" 199 | }, 200 | "type": "library", 201 | "extra": { 202 | "branch-alias": { 203 | "dev-master": "1.0.x-dev" 204 | } 205 | }, 206 | "autoload": { 207 | "classmap": [ 208 | "src/" 209 | ] 210 | }, 211 | "notification-url": "https://packagist.org/downloads/", 212 | "license": [ 213 | "BSD-3-Clause" 214 | ], 215 | "authors": [ 216 | { 217 | "name": "Arne Blankerts", 218 | "email": "arne@blankerts.de", 219 | "role": "Developer" 220 | }, 221 | { 222 | "name": "Sebastian Heuer", 223 | "email": "sebastian@phpeople.de", 224 | "role": "Developer" 225 | }, 226 | { 227 | "name": "Sebastian Bergmann", 228 | "email": "sebastian@phpunit.de", 229 | "role": "Developer" 230 | } 231 | ], 232 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 233 | "time": "2017-03-05T18:14:27+00:00" 234 | }, 235 | { 236 | "name": "phar-io/version", 237 | "version": "1.0.1", 238 | "source": { 239 | "type": "git", 240 | "url": "https://github.com/phar-io/version.git", 241 | "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" 242 | }, 243 | "dist": { 244 | "type": "zip", 245 | "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", 246 | "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", 247 | "shasum": "" 248 | }, 249 | "require": { 250 | "php": "^5.6 || ^7.0" 251 | }, 252 | "type": "library", 253 | "autoload": { 254 | "classmap": [ 255 | "src/" 256 | ] 257 | }, 258 | "notification-url": "https://packagist.org/downloads/", 259 | "license": [ 260 | "BSD-3-Clause" 261 | ], 262 | "authors": [ 263 | { 264 | "name": "Arne Blankerts", 265 | "email": "arne@blankerts.de", 266 | "role": "Developer" 267 | }, 268 | { 269 | "name": "Sebastian Heuer", 270 | "email": "sebastian@phpeople.de", 271 | "role": "Developer" 272 | }, 273 | { 274 | "name": "Sebastian Bergmann", 275 | "email": "sebastian@phpunit.de", 276 | "role": "Developer" 277 | } 278 | ], 279 | "description": "Library for handling version information and constraints", 280 | "time": "2017-03-05T17:38:23+00:00" 281 | }, 282 | { 283 | "name": "php-mock/php-mock", 284 | "version": "2.2.1", 285 | "source": { 286 | "type": "git", 287 | "url": "https://github.com/php-mock/php-mock.git", 288 | "reference": "8ca7205ad5e73fbbffa9bde9f6bc90daf5e49702" 289 | }, 290 | "dist": { 291 | "type": "zip", 292 | "url": "https://api.github.com/repos/php-mock/php-mock/zipball/8ca7205ad5e73fbbffa9bde9f6bc90daf5e49702", 293 | "reference": "8ca7205ad5e73fbbffa9bde9f6bc90daf5e49702", 294 | "shasum": "" 295 | }, 296 | "require": { 297 | "php": "^5.6 || ^7.0", 298 | "phpunit/php-text-template": "^1 || ^2" 299 | }, 300 | "replace": { 301 | "malkusch/php-mock": "*" 302 | }, 303 | "require-dev": { 304 | "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.0 || ^9.0" 305 | }, 306 | "suggest": { 307 | "php-mock/php-mock-phpunit": "Allows integration into PHPUnit testcase with the trait PHPMock." 308 | }, 309 | "type": "library", 310 | "autoload": { 311 | "files": [ 312 | "autoload.php" 313 | ], 314 | "psr-4": { 315 | "phpmock\\": [ 316 | "classes/", 317 | "tests/" 318 | ] 319 | } 320 | }, 321 | "notification-url": "https://packagist.org/downloads/", 322 | "license": [ 323 | "WTFPL" 324 | ], 325 | "authors": [ 326 | { 327 | "name": "Markus Malkusch", 328 | "email": "markus@malkusch.de", 329 | "homepage": "http://markus.malkusch.de", 330 | "role": "Developer" 331 | } 332 | ], 333 | "description": "PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.", 334 | "homepage": "https://github.com/php-mock/php-mock", 335 | "keywords": [ 336 | "BDD", 337 | "TDD", 338 | "function", 339 | "mock", 340 | "stub", 341 | "test", 342 | "test double" 343 | ], 344 | "time": "2020-02-08T14:50:32+00:00" 345 | }, 346 | { 347 | "name": "php-mock/php-mock-integration", 348 | "version": "2.1.0", 349 | "source": { 350 | "type": "git", 351 | "url": "https://github.com/php-mock/php-mock-integration.git", 352 | "reference": "003d585841e435958a02e9b986953907b8b7609b" 353 | }, 354 | "dist": { 355 | "type": "zip", 356 | "url": "https://api.github.com/repos/php-mock/php-mock-integration/zipball/003d585841e435958a02e9b986953907b8b7609b", 357 | "reference": "003d585841e435958a02e9b986953907b8b7609b", 358 | "shasum": "" 359 | }, 360 | "require": { 361 | "php": ">=5.6", 362 | "php-mock/php-mock": "^2.2", 363 | "phpunit/php-text-template": "^1 || ^2" 364 | }, 365 | "require-dev": { 366 | "phpunit/phpunit": "^5.7.27 || ^6 || ^7 || ^8 || ^9" 367 | }, 368 | "type": "library", 369 | "autoload": { 370 | "psr-4": { 371 | "phpmock\\integration\\": "classes/" 372 | } 373 | }, 374 | "notification-url": "https://packagist.org/downloads/", 375 | "license": [ 376 | "WTFPL" 377 | ], 378 | "authors": [ 379 | { 380 | "name": "Markus Malkusch", 381 | "email": "markus@malkusch.de", 382 | "homepage": "http://markus.malkusch.de", 383 | "role": "Developer" 384 | } 385 | ], 386 | "description": "Integration package for PHP-Mock", 387 | "homepage": "https://github.com/php-mock/php-mock-integration", 388 | "keywords": [ 389 | "BDD", 390 | "TDD", 391 | "function", 392 | "mock", 393 | "stub", 394 | "test", 395 | "test double" 396 | ], 397 | "time": "2020-02-08T14:40:25+00:00" 398 | }, 399 | { 400 | "name": "php-mock/php-mock-phpunit", 401 | "version": "2.6.0", 402 | "source": { 403 | "type": "git", 404 | "url": "https://github.com/php-mock/php-mock-phpunit.git", 405 | "reference": "2877a0e58f12e91b64bf36ccd080a209dcbf6c30" 406 | }, 407 | "dist": { 408 | "type": "zip", 409 | "url": "https://api.github.com/repos/php-mock/php-mock-phpunit/zipball/2877a0e58f12e91b64bf36ccd080a209dcbf6c30", 410 | "reference": "2877a0e58f12e91b64bf36ccd080a209dcbf6c30", 411 | "shasum": "" 412 | }, 413 | "require": { 414 | "php": ">=7", 415 | "php-mock/php-mock-integration": "^2.1", 416 | "phpunit/phpunit": "^6 || ^7 || ^8 || ^9" 417 | }, 418 | "type": "library", 419 | "autoload": { 420 | "files": [ 421 | "autoload.php" 422 | ], 423 | "psr-4": { 424 | "phpmock\\phpunit\\": "classes/" 425 | } 426 | }, 427 | "notification-url": "https://packagist.org/downloads/", 428 | "license": [ 429 | "WTFPL" 430 | ], 431 | "authors": [ 432 | { 433 | "name": "Markus Malkusch", 434 | "email": "markus@malkusch.de", 435 | "homepage": "http://markus.malkusch.de", 436 | "role": "Developer" 437 | } 438 | ], 439 | "description": "Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.", 440 | "homepage": "https://github.com/php-mock/php-mock-phpunit", 441 | "keywords": [ 442 | "BDD", 443 | "TDD", 444 | "function", 445 | "mock", 446 | "phpunit", 447 | "stub", 448 | "test", 449 | "test double" 450 | ], 451 | "time": "2020-02-08T15:44:47+00:00" 452 | }, 453 | { 454 | "name": "phpcompatibility/php-compatibility", 455 | "version": "9.3.5", 456 | "source": { 457 | "type": "git", 458 | "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", 459 | "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" 460 | }, 461 | "dist": { 462 | "type": "zip", 463 | "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", 464 | "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", 465 | "shasum": "" 466 | }, 467 | "require": { 468 | "php": ">=5.3", 469 | "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" 470 | }, 471 | "conflict": { 472 | "squizlabs/php_codesniffer": "2.6.2" 473 | }, 474 | "require-dev": { 475 | "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" 476 | }, 477 | "suggest": { 478 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", 479 | "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." 480 | }, 481 | "type": "phpcodesniffer-standard", 482 | "notification-url": "https://packagist.org/downloads/", 483 | "license": [ 484 | "LGPL-3.0-or-later" 485 | ], 486 | "authors": [ 487 | { 488 | "name": "Wim Godden", 489 | "homepage": "https://github.com/wimg", 490 | "role": "lead" 491 | }, 492 | { 493 | "name": "Juliette Reinders Folmer", 494 | "homepage": "https://github.com/jrfnl", 495 | "role": "lead" 496 | }, 497 | { 498 | "name": "Contributors", 499 | "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" 500 | } 501 | ], 502 | "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", 503 | "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", 504 | "keywords": [ 505 | "compatibility", 506 | "phpcs", 507 | "standards" 508 | ], 509 | "time": "2019-12-27T09:44:58+00:00" 510 | }, 511 | { 512 | "name": "phpdocumentor/reflection-common", 513 | "version": "2.0.0", 514 | "source": { 515 | "type": "git", 516 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 517 | "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" 518 | }, 519 | "dist": { 520 | "type": "zip", 521 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", 522 | "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", 523 | "shasum": "" 524 | }, 525 | "require": { 526 | "php": ">=7.1" 527 | }, 528 | "require-dev": { 529 | "phpunit/phpunit": "~6" 530 | }, 531 | "type": "library", 532 | "extra": { 533 | "branch-alias": { 534 | "dev-master": "2.x-dev" 535 | } 536 | }, 537 | "autoload": { 538 | "psr-4": { 539 | "phpDocumentor\\Reflection\\": "src/" 540 | } 541 | }, 542 | "notification-url": "https://packagist.org/downloads/", 543 | "license": [ 544 | "MIT" 545 | ], 546 | "authors": [ 547 | { 548 | "name": "Jaap van Otterdijk", 549 | "email": "opensource@ijaap.nl" 550 | } 551 | ], 552 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 553 | "homepage": "http://www.phpdoc.org", 554 | "keywords": [ 555 | "FQSEN", 556 | "phpDocumentor", 557 | "phpdoc", 558 | "reflection", 559 | "static analysis" 560 | ], 561 | "time": "2018-08-07T13:53:10+00:00" 562 | }, 563 | { 564 | "name": "phpdocumentor/reflection-docblock", 565 | "version": "5.0.0", 566 | "source": { 567 | "type": "git", 568 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 569 | "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f" 570 | }, 571 | "dist": { 572 | "type": "zip", 573 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a48807183a4b819072f26e347bbd0b5199a9d15f", 574 | "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f", 575 | "shasum": "" 576 | }, 577 | "require": { 578 | "ext-filter": "^7.1", 579 | "php": "^7.2", 580 | "phpdocumentor/reflection-common": "^2.0", 581 | "phpdocumentor/type-resolver": "^1.0", 582 | "webmozart/assert": "^1" 583 | }, 584 | "require-dev": { 585 | "doctrine/instantiator": "^1", 586 | "mockery/mockery": "^1" 587 | }, 588 | "type": "library", 589 | "extra": { 590 | "branch-alias": { 591 | "dev-master": "5.x-dev" 592 | } 593 | }, 594 | "autoload": { 595 | "psr-4": { 596 | "phpDocumentor\\Reflection\\": "src" 597 | } 598 | }, 599 | "notification-url": "https://packagist.org/downloads/", 600 | "license": [ 601 | "MIT" 602 | ], 603 | "authors": [ 604 | { 605 | "name": "Mike van Riel", 606 | "email": "me@mikevanriel.com" 607 | }, 608 | { 609 | "name": "Jaap van Otterdijk", 610 | "email": "account@ijaap.nl" 611 | } 612 | ], 613 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 614 | "time": "2020-02-09T09:16:15+00:00" 615 | }, 616 | { 617 | "name": "phpdocumentor/type-resolver", 618 | "version": "1.0.1", 619 | "source": { 620 | "type": "git", 621 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 622 | "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" 623 | }, 624 | "dist": { 625 | "type": "zip", 626 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", 627 | "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", 628 | "shasum": "" 629 | }, 630 | "require": { 631 | "php": "^7.1", 632 | "phpdocumentor/reflection-common": "^2.0" 633 | }, 634 | "require-dev": { 635 | "ext-tokenizer": "^7.1", 636 | "mockery/mockery": "~1", 637 | "phpunit/phpunit": "^7.0" 638 | }, 639 | "type": "library", 640 | "extra": { 641 | "branch-alias": { 642 | "dev-master": "1.x-dev" 643 | } 644 | }, 645 | "autoload": { 646 | "psr-4": { 647 | "phpDocumentor\\Reflection\\": "src" 648 | } 649 | }, 650 | "notification-url": "https://packagist.org/downloads/", 651 | "license": [ 652 | "MIT" 653 | ], 654 | "authors": [ 655 | { 656 | "name": "Mike van Riel", 657 | "email": "me@mikevanriel.com" 658 | } 659 | ], 660 | "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", 661 | "time": "2019-08-22T18:11:29+00:00" 662 | }, 663 | { 664 | "name": "phpspec/prophecy", 665 | "version": "v1.10.2", 666 | "source": { 667 | "type": "git", 668 | "url": "https://github.com/phpspec/prophecy.git", 669 | "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9" 670 | }, 671 | "dist": { 672 | "type": "zip", 673 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9", 674 | "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9", 675 | "shasum": "" 676 | }, 677 | "require": { 678 | "doctrine/instantiator": "^1.0.2", 679 | "php": "^5.3|^7.0", 680 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", 681 | "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", 682 | "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" 683 | }, 684 | "require-dev": { 685 | "phpspec/phpspec": "^2.5 || ^3.2", 686 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" 687 | }, 688 | "type": "library", 689 | "extra": { 690 | "branch-alias": { 691 | "dev-master": "1.10.x-dev" 692 | } 693 | }, 694 | "autoload": { 695 | "psr-4": { 696 | "Prophecy\\": "src/Prophecy" 697 | } 698 | }, 699 | "notification-url": "https://packagist.org/downloads/", 700 | "license": [ 701 | "MIT" 702 | ], 703 | "authors": [ 704 | { 705 | "name": "Konstantin Kudryashov", 706 | "email": "ever.zet@gmail.com", 707 | "homepage": "http://everzet.com" 708 | }, 709 | { 710 | "name": "Marcello Duarte", 711 | "email": "marcello.duarte@gmail.com" 712 | } 713 | ], 714 | "description": "Highly opinionated mocking framework for PHP 5.3+", 715 | "homepage": "https://github.com/phpspec/prophecy", 716 | "keywords": [ 717 | "Double", 718 | "Dummy", 719 | "fake", 720 | "mock", 721 | "spy", 722 | "stub" 723 | ], 724 | "time": "2020-01-20T15:57:02+00:00" 725 | }, 726 | { 727 | "name": "phpunit/php-code-coverage", 728 | "version": "5.3.2", 729 | "source": { 730 | "type": "git", 731 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 732 | "reference": "c89677919c5dd6d3b3852f230a663118762218ac" 733 | }, 734 | "dist": { 735 | "type": "zip", 736 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", 737 | "reference": "c89677919c5dd6d3b3852f230a663118762218ac", 738 | "shasum": "" 739 | }, 740 | "require": { 741 | "ext-dom": "*", 742 | "ext-xmlwriter": "*", 743 | "php": "^7.0", 744 | "phpunit/php-file-iterator": "^1.4.2", 745 | "phpunit/php-text-template": "^1.2.1", 746 | "phpunit/php-token-stream": "^2.0.1", 747 | "sebastian/code-unit-reverse-lookup": "^1.0.1", 748 | "sebastian/environment": "^3.0", 749 | "sebastian/version": "^2.0.1", 750 | "theseer/tokenizer": "^1.1" 751 | }, 752 | "require-dev": { 753 | "phpunit/phpunit": "^6.0" 754 | }, 755 | "suggest": { 756 | "ext-xdebug": "^2.5.5" 757 | }, 758 | "type": "library", 759 | "extra": { 760 | "branch-alias": { 761 | "dev-master": "5.3.x-dev" 762 | } 763 | }, 764 | "autoload": { 765 | "classmap": [ 766 | "src/" 767 | ] 768 | }, 769 | "notification-url": "https://packagist.org/downloads/", 770 | "license": [ 771 | "BSD-3-Clause" 772 | ], 773 | "authors": [ 774 | { 775 | "name": "Sebastian Bergmann", 776 | "email": "sebastian@phpunit.de", 777 | "role": "lead" 778 | } 779 | ], 780 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 781 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 782 | "keywords": [ 783 | "coverage", 784 | "testing", 785 | "xunit" 786 | ], 787 | "time": "2018-04-06T15:36:58+00:00" 788 | }, 789 | { 790 | "name": "phpunit/php-file-iterator", 791 | "version": "1.4.5", 792 | "source": { 793 | "type": "git", 794 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 795 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" 796 | }, 797 | "dist": { 798 | "type": "zip", 799 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", 800 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", 801 | "shasum": "" 802 | }, 803 | "require": { 804 | "php": ">=5.3.3" 805 | }, 806 | "type": "library", 807 | "extra": { 808 | "branch-alias": { 809 | "dev-master": "1.4.x-dev" 810 | } 811 | }, 812 | "autoload": { 813 | "classmap": [ 814 | "src/" 815 | ] 816 | }, 817 | "notification-url": "https://packagist.org/downloads/", 818 | "license": [ 819 | "BSD-3-Clause" 820 | ], 821 | "authors": [ 822 | { 823 | "name": "Sebastian Bergmann", 824 | "email": "sb@sebastian-bergmann.de", 825 | "role": "lead" 826 | } 827 | ], 828 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 829 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 830 | "keywords": [ 831 | "filesystem", 832 | "iterator" 833 | ], 834 | "time": "2017-11-27T13:52:08+00:00" 835 | }, 836 | { 837 | "name": "phpunit/php-text-template", 838 | "version": "1.2.1", 839 | "source": { 840 | "type": "git", 841 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 842 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 843 | }, 844 | "dist": { 845 | "type": "zip", 846 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 847 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 848 | "shasum": "" 849 | }, 850 | "require": { 851 | "php": ">=5.3.3" 852 | }, 853 | "type": "library", 854 | "autoload": { 855 | "classmap": [ 856 | "src/" 857 | ] 858 | }, 859 | "notification-url": "https://packagist.org/downloads/", 860 | "license": [ 861 | "BSD-3-Clause" 862 | ], 863 | "authors": [ 864 | { 865 | "name": "Sebastian Bergmann", 866 | "email": "sebastian@phpunit.de", 867 | "role": "lead" 868 | } 869 | ], 870 | "description": "Simple template engine.", 871 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 872 | "keywords": [ 873 | "template" 874 | ], 875 | "time": "2015-06-21T13:50:34+00:00" 876 | }, 877 | { 878 | "name": "phpunit/php-timer", 879 | "version": "1.0.9", 880 | "source": { 881 | "type": "git", 882 | "url": "https://github.com/sebastianbergmann/php-timer.git", 883 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" 884 | }, 885 | "dist": { 886 | "type": "zip", 887 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 888 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 889 | "shasum": "" 890 | }, 891 | "require": { 892 | "php": "^5.3.3 || ^7.0" 893 | }, 894 | "require-dev": { 895 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 896 | }, 897 | "type": "library", 898 | "extra": { 899 | "branch-alias": { 900 | "dev-master": "1.0-dev" 901 | } 902 | }, 903 | "autoload": { 904 | "classmap": [ 905 | "src/" 906 | ] 907 | }, 908 | "notification-url": "https://packagist.org/downloads/", 909 | "license": [ 910 | "BSD-3-Clause" 911 | ], 912 | "authors": [ 913 | { 914 | "name": "Sebastian Bergmann", 915 | "email": "sb@sebastian-bergmann.de", 916 | "role": "lead" 917 | } 918 | ], 919 | "description": "Utility class for timing", 920 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 921 | "keywords": [ 922 | "timer" 923 | ], 924 | "time": "2017-02-26T11:10:40+00:00" 925 | }, 926 | { 927 | "name": "phpunit/php-token-stream", 928 | "version": "2.0.2", 929 | "source": { 930 | "type": "git", 931 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 932 | "reference": "791198a2c6254db10131eecfe8c06670700904db" 933 | }, 934 | "dist": { 935 | "type": "zip", 936 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", 937 | "reference": "791198a2c6254db10131eecfe8c06670700904db", 938 | "shasum": "" 939 | }, 940 | "require": { 941 | "ext-tokenizer": "*", 942 | "php": "^7.0" 943 | }, 944 | "require-dev": { 945 | "phpunit/phpunit": "^6.2.4" 946 | }, 947 | "type": "library", 948 | "extra": { 949 | "branch-alias": { 950 | "dev-master": "2.0-dev" 951 | } 952 | }, 953 | "autoload": { 954 | "classmap": [ 955 | "src/" 956 | ] 957 | }, 958 | "notification-url": "https://packagist.org/downloads/", 959 | "license": [ 960 | "BSD-3-Clause" 961 | ], 962 | "authors": [ 963 | { 964 | "name": "Sebastian Bergmann", 965 | "email": "sebastian@phpunit.de" 966 | } 967 | ], 968 | "description": "Wrapper around PHP's tokenizer extension.", 969 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 970 | "keywords": [ 971 | "tokenizer" 972 | ], 973 | "time": "2017-11-27T05:48:46+00:00" 974 | }, 975 | { 976 | "name": "phpunit/phpunit", 977 | "version": "6.5.14", 978 | "source": { 979 | "type": "git", 980 | "url": "https://github.com/sebastianbergmann/phpunit.git", 981 | "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" 982 | }, 983 | "dist": { 984 | "type": "zip", 985 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", 986 | "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", 987 | "shasum": "" 988 | }, 989 | "require": { 990 | "ext-dom": "*", 991 | "ext-json": "*", 992 | "ext-libxml": "*", 993 | "ext-mbstring": "*", 994 | "ext-xml": "*", 995 | "myclabs/deep-copy": "^1.6.1", 996 | "phar-io/manifest": "^1.0.1", 997 | "phar-io/version": "^1.0", 998 | "php": "^7.0", 999 | "phpspec/prophecy": "^1.7", 1000 | "phpunit/php-code-coverage": "^5.3", 1001 | "phpunit/php-file-iterator": "^1.4.3", 1002 | "phpunit/php-text-template": "^1.2.1", 1003 | "phpunit/php-timer": "^1.0.9", 1004 | "phpunit/phpunit-mock-objects": "^5.0.9", 1005 | "sebastian/comparator": "^2.1", 1006 | "sebastian/diff": "^2.0", 1007 | "sebastian/environment": "^3.1", 1008 | "sebastian/exporter": "^3.1", 1009 | "sebastian/global-state": "^2.0", 1010 | "sebastian/object-enumerator": "^3.0.3", 1011 | "sebastian/resource-operations": "^1.0", 1012 | "sebastian/version": "^2.0.1" 1013 | }, 1014 | "conflict": { 1015 | "phpdocumentor/reflection-docblock": "3.0.2", 1016 | "phpunit/dbunit": "<3.0" 1017 | }, 1018 | "require-dev": { 1019 | "ext-pdo": "*" 1020 | }, 1021 | "suggest": { 1022 | "ext-xdebug": "*", 1023 | "phpunit/php-invoker": "^1.1" 1024 | }, 1025 | "bin": [ 1026 | "phpunit" 1027 | ], 1028 | "type": "library", 1029 | "extra": { 1030 | "branch-alias": { 1031 | "dev-master": "6.5.x-dev" 1032 | } 1033 | }, 1034 | "autoload": { 1035 | "classmap": [ 1036 | "src/" 1037 | ] 1038 | }, 1039 | "notification-url": "https://packagist.org/downloads/", 1040 | "license": [ 1041 | "BSD-3-Clause" 1042 | ], 1043 | "authors": [ 1044 | { 1045 | "name": "Sebastian Bergmann", 1046 | "email": "sebastian@phpunit.de", 1047 | "role": "lead" 1048 | } 1049 | ], 1050 | "description": "The PHP Unit Testing framework.", 1051 | "homepage": "https://phpunit.de/", 1052 | "keywords": [ 1053 | "phpunit", 1054 | "testing", 1055 | "xunit" 1056 | ], 1057 | "time": "2019-02-01T05:22:47+00:00" 1058 | }, 1059 | { 1060 | "name": "phpunit/phpunit-mock-objects", 1061 | "version": "5.0.10", 1062 | "source": { 1063 | "type": "git", 1064 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 1065 | "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" 1066 | }, 1067 | "dist": { 1068 | "type": "zip", 1069 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", 1070 | "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", 1071 | "shasum": "" 1072 | }, 1073 | "require": { 1074 | "doctrine/instantiator": "^1.0.5", 1075 | "php": "^7.0", 1076 | "phpunit/php-text-template": "^1.2.1", 1077 | "sebastian/exporter": "^3.1" 1078 | }, 1079 | "conflict": { 1080 | "phpunit/phpunit": "<6.0" 1081 | }, 1082 | "require-dev": { 1083 | "phpunit/phpunit": "^6.5.11" 1084 | }, 1085 | "suggest": { 1086 | "ext-soap": "*" 1087 | }, 1088 | "type": "library", 1089 | "extra": { 1090 | "branch-alias": { 1091 | "dev-master": "5.0.x-dev" 1092 | } 1093 | }, 1094 | "autoload": { 1095 | "classmap": [ 1096 | "src/" 1097 | ] 1098 | }, 1099 | "notification-url": "https://packagist.org/downloads/", 1100 | "license": [ 1101 | "BSD-3-Clause" 1102 | ], 1103 | "authors": [ 1104 | { 1105 | "name": "Sebastian Bergmann", 1106 | "email": "sebastian@phpunit.de", 1107 | "role": "lead" 1108 | } 1109 | ], 1110 | "description": "Mock Object library for PHPUnit", 1111 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 1112 | "keywords": [ 1113 | "mock", 1114 | "xunit" 1115 | ], 1116 | "abandoned": true, 1117 | "time": "2018-08-09T05:50:03+00:00" 1118 | }, 1119 | { 1120 | "name": "sebastian/code-unit-reverse-lookup", 1121 | "version": "1.0.1", 1122 | "source": { 1123 | "type": "git", 1124 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 1125 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" 1126 | }, 1127 | "dist": { 1128 | "type": "zip", 1129 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 1130 | "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", 1131 | "shasum": "" 1132 | }, 1133 | "require": { 1134 | "php": "^5.6 || ^7.0" 1135 | }, 1136 | "require-dev": { 1137 | "phpunit/phpunit": "^5.7 || ^6.0" 1138 | }, 1139 | "type": "library", 1140 | "extra": { 1141 | "branch-alias": { 1142 | "dev-master": "1.0.x-dev" 1143 | } 1144 | }, 1145 | "autoload": { 1146 | "classmap": [ 1147 | "src/" 1148 | ] 1149 | }, 1150 | "notification-url": "https://packagist.org/downloads/", 1151 | "license": [ 1152 | "BSD-3-Clause" 1153 | ], 1154 | "authors": [ 1155 | { 1156 | "name": "Sebastian Bergmann", 1157 | "email": "sebastian@phpunit.de" 1158 | } 1159 | ], 1160 | "description": "Looks up which function or method a line of code belongs to", 1161 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 1162 | "time": "2017-03-04T06:30:41+00:00" 1163 | }, 1164 | { 1165 | "name": "sebastian/comparator", 1166 | "version": "2.1.3", 1167 | "source": { 1168 | "type": "git", 1169 | "url": "https://github.com/sebastianbergmann/comparator.git", 1170 | "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" 1171 | }, 1172 | "dist": { 1173 | "type": "zip", 1174 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", 1175 | "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", 1176 | "shasum": "" 1177 | }, 1178 | "require": { 1179 | "php": "^7.0", 1180 | "sebastian/diff": "^2.0 || ^3.0", 1181 | "sebastian/exporter": "^3.1" 1182 | }, 1183 | "require-dev": { 1184 | "phpunit/phpunit": "^6.4" 1185 | }, 1186 | "type": "library", 1187 | "extra": { 1188 | "branch-alias": { 1189 | "dev-master": "2.1.x-dev" 1190 | } 1191 | }, 1192 | "autoload": { 1193 | "classmap": [ 1194 | "src/" 1195 | ] 1196 | }, 1197 | "notification-url": "https://packagist.org/downloads/", 1198 | "license": [ 1199 | "BSD-3-Clause" 1200 | ], 1201 | "authors": [ 1202 | { 1203 | "name": "Jeff Welch", 1204 | "email": "whatthejeff@gmail.com" 1205 | }, 1206 | { 1207 | "name": "Volker Dusch", 1208 | "email": "github@wallbash.com" 1209 | }, 1210 | { 1211 | "name": "Bernhard Schussek", 1212 | "email": "bschussek@2bepublished.at" 1213 | }, 1214 | { 1215 | "name": "Sebastian Bergmann", 1216 | "email": "sebastian@phpunit.de" 1217 | } 1218 | ], 1219 | "description": "Provides the functionality to compare PHP values for equality", 1220 | "homepage": "https://github.com/sebastianbergmann/comparator", 1221 | "keywords": [ 1222 | "comparator", 1223 | "compare", 1224 | "equality" 1225 | ], 1226 | "time": "2018-02-01T13:46:46+00:00" 1227 | }, 1228 | { 1229 | "name": "sebastian/diff", 1230 | "version": "2.0.1", 1231 | "source": { 1232 | "type": "git", 1233 | "url": "https://github.com/sebastianbergmann/diff.git", 1234 | "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" 1235 | }, 1236 | "dist": { 1237 | "type": "zip", 1238 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", 1239 | "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", 1240 | "shasum": "" 1241 | }, 1242 | "require": { 1243 | "php": "^7.0" 1244 | }, 1245 | "require-dev": { 1246 | "phpunit/phpunit": "^6.2" 1247 | }, 1248 | "type": "library", 1249 | "extra": { 1250 | "branch-alias": { 1251 | "dev-master": "2.0-dev" 1252 | } 1253 | }, 1254 | "autoload": { 1255 | "classmap": [ 1256 | "src/" 1257 | ] 1258 | }, 1259 | "notification-url": "https://packagist.org/downloads/", 1260 | "license": [ 1261 | "BSD-3-Clause" 1262 | ], 1263 | "authors": [ 1264 | { 1265 | "name": "Kore Nordmann", 1266 | "email": "mail@kore-nordmann.de" 1267 | }, 1268 | { 1269 | "name": "Sebastian Bergmann", 1270 | "email": "sebastian@phpunit.de" 1271 | } 1272 | ], 1273 | "description": "Diff implementation", 1274 | "homepage": "https://github.com/sebastianbergmann/diff", 1275 | "keywords": [ 1276 | "diff" 1277 | ], 1278 | "time": "2017-08-03T08:09:46+00:00" 1279 | }, 1280 | { 1281 | "name": "sebastian/environment", 1282 | "version": "3.1.0", 1283 | "source": { 1284 | "type": "git", 1285 | "url": "https://github.com/sebastianbergmann/environment.git", 1286 | "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" 1287 | }, 1288 | "dist": { 1289 | "type": "zip", 1290 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", 1291 | "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", 1292 | "shasum": "" 1293 | }, 1294 | "require": { 1295 | "php": "^7.0" 1296 | }, 1297 | "require-dev": { 1298 | "phpunit/phpunit": "^6.1" 1299 | }, 1300 | "type": "library", 1301 | "extra": { 1302 | "branch-alias": { 1303 | "dev-master": "3.1.x-dev" 1304 | } 1305 | }, 1306 | "autoload": { 1307 | "classmap": [ 1308 | "src/" 1309 | ] 1310 | }, 1311 | "notification-url": "https://packagist.org/downloads/", 1312 | "license": [ 1313 | "BSD-3-Clause" 1314 | ], 1315 | "authors": [ 1316 | { 1317 | "name": "Sebastian Bergmann", 1318 | "email": "sebastian@phpunit.de" 1319 | } 1320 | ], 1321 | "description": "Provides functionality to handle HHVM/PHP environments", 1322 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1323 | "keywords": [ 1324 | "Xdebug", 1325 | "environment", 1326 | "hhvm" 1327 | ], 1328 | "time": "2017-07-01T08:51:00+00:00" 1329 | }, 1330 | { 1331 | "name": "sebastian/exporter", 1332 | "version": "3.1.2", 1333 | "source": { 1334 | "type": "git", 1335 | "url": "https://github.com/sebastianbergmann/exporter.git", 1336 | "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" 1337 | }, 1338 | "dist": { 1339 | "type": "zip", 1340 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", 1341 | "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", 1342 | "shasum": "" 1343 | }, 1344 | "require": { 1345 | "php": "^7.0", 1346 | "sebastian/recursion-context": "^3.0" 1347 | }, 1348 | "require-dev": { 1349 | "ext-mbstring": "*", 1350 | "phpunit/phpunit": "^6.0" 1351 | }, 1352 | "type": "library", 1353 | "extra": { 1354 | "branch-alias": { 1355 | "dev-master": "3.1.x-dev" 1356 | } 1357 | }, 1358 | "autoload": { 1359 | "classmap": [ 1360 | "src/" 1361 | ] 1362 | }, 1363 | "notification-url": "https://packagist.org/downloads/", 1364 | "license": [ 1365 | "BSD-3-Clause" 1366 | ], 1367 | "authors": [ 1368 | { 1369 | "name": "Sebastian Bergmann", 1370 | "email": "sebastian@phpunit.de" 1371 | }, 1372 | { 1373 | "name": "Jeff Welch", 1374 | "email": "whatthejeff@gmail.com" 1375 | }, 1376 | { 1377 | "name": "Volker Dusch", 1378 | "email": "github@wallbash.com" 1379 | }, 1380 | { 1381 | "name": "Adam Harvey", 1382 | "email": "aharvey@php.net" 1383 | }, 1384 | { 1385 | "name": "Bernhard Schussek", 1386 | "email": "bschussek@gmail.com" 1387 | } 1388 | ], 1389 | "description": "Provides the functionality to export PHP variables for visualization", 1390 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1391 | "keywords": [ 1392 | "export", 1393 | "exporter" 1394 | ], 1395 | "time": "2019-09-14T09:02:43+00:00" 1396 | }, 1397 | { 1398 | "name": "sebastian/global-state", 1399 | "version": "2.0.0", 1400 | "source": { 1401 | "type": "git", 1402 | "url": "https://github.com/sebastianbergmann/global-state.git", 1403 | "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" 1404 | }, 1405 | "dist": { 1406 | "type": "zip", 1407 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", 1408 | "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", 1409 | "shasum": "" 1410 | }, 1411 | "require": { 1412 | "php": "^7.0" 1413 | }, 1414 | "require-dev": { 1415 | "phpunit/phpunit": "^6.0" 1416 | }, 1417 | "suggest": { 1418 | "ext-uopz": "*" 1419 | }, 1420 | "type": "library", 1421 | "extra": { 1422 | "branch-alias": { 1423 | "dev-master": "2.0-dev" 1424 | } 1425 | }, 1426 | "autoload": { 1427 | "classmap": [ 1428 | "src/" 1429 | ] 1430 | }, 1431 | "notification-url": "https://packagist.org/downloads/", 1432 | "license": [ 1433 | "BSD-3-Clause" 1434 | ], 1435 | "authors": [ 1436 | { 1437 | "name": "Sebastian Bergmann", 1438 | "email": "sebastian@phpunit.de" 1439 | } 1440 | ], 1441 | "description": "Snapshotting of global state", 1442 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1443 | "keywords": [ 1444 | "global state" 1445 | ], 1446 | "time": "2017-04-27T15:39:26+00:00" 1447 | }, 1448 | { 1449 | "name": "sebastian/object-enumerator", 1450 | "version": "3.0.3", 1451 | "source": { 1452 | "type": "git", 1453 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1454 | "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" 1455 | }, 1456 | "dist": { 1457 | "type": "zip", 1458 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", 1459 | "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", 1460 | "shasum": "" 1461 | }, 1462 | "require": { 1463 | "php": "^7.0", 1464 | "sebastian/object-reflector": "^1.1.1", 1465 | "sebastian/recursion-context": "^3.0" 1466 | }, 1467 | "require-dev": { 1468 | "phpunit/phpunit": "^6.0" 1469 | }, 1470 | "type": "library", 1471 | "extra": { 1472 | "branch-alias": { 1473 | "dev-master": "3.0.x-dev" 1474 | } 1475 | }, 1476 | "autoload": { 1477 | "classmap": [ 1478 | "src/" 1479 | ] 1480 | }, 1481 | "notification-url": "https://packagist.org/downloads/", 1482 | "license": [ 1483 | "BSD-3-Clause" 1484 | ], 1485 | "authors": [ 1486 | { 1487 | "name": "Sebastian Bergmann", 1488 | "email": "sebastian@phpunit.de" 1489 | } 1490 | ], 1491 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1492 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1493 | "time": "2017-08-03T12:35:26+00:00" 1494 | }, 1495 | { 1496 | "name": "sebastian/object-reflector", 1497 | "version": "1.1.1", 1498 | "source": { 1499 | "type": "git", 1500 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1501 | "reference": "773f97c67f28de00d397be301821b06708fca0be" 1502 | }, 1503 | "dist": { 1504 | "type": "zip", 1505 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", 1506 | "reference": "773f97c67f28de00d397be301821b06708fca0be", 1507 | "shasum": "" 1508 | }, 1509 | "require": { 1510 | "php": "^7.0" 1511 | }, 1512 | "require-dev": { 1513 | "phpunit/phpunit": "^6.0" 1514 | }, 1515 | "type": "library", 1516 | "extra": { 1517 | "branch-alias": { 1518 | "dev-master": "1.1-dev" 1519 | } 1520 | }, 1521 | "autoload": { 1522 | "classmap": [ 1523 | "src/" 1524 | ] 1525 | }, 1526 | "notification-url": "https://packagist.org/downloads/", 1527 | "license": [ 1528 | "BSD-3-Clause" 1529 | ], 1530 | "authors": [ 1531 | { 1532 | "name": "Sebastian Bergmann", 1533 | "email": "sebastian@phpunit.de" 1534 | } 1535 | ], 1536 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1537 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1538 | "time": "2017-03-29T09:07:27+00:00" 1539 | }, 1540 | { 1541 | "name": "sebastian/recursion-context", 1542 | "version": "3.0.0", 1543 | "source": { 1544 | "type": "git", 1545 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1546 | "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" 1547 | }, 1548 | "dist": { 1549 | "type": "zip", 1550 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", 1551 | "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", 1552 | "shasum": "" 1553 | }, 1554 | "require": { 1555 | "php": "^7.0" 1556 | }, 1557 | "require-dev": { 1558 | "phpunit/phpunit": "^6.0" 1559 | }, 1560 | "type": "library", 1561 | "extra": { 1562 | "branch-alias": { 1563 | "dev-master": "3.0.x-dev" 1564 | } 1565 | }, 1566 | "autoload": { 1567 | "classmap": [ 1568 | "src/" 1569 | ] 1570 | }, 1571 | "notification-url": "https://packagist.org/downloads/", 1572 | "license": [ 1573 | "BSD-3-Clause" 1574 | ], 1575 | "authors": [ 1576 | { 1577 | "name": "Jeff Welch", 1578 | "email": "whatthejeff@gmail.com" 1579 | }, 1580 | { 1581 | "name": "Sebastian Bergmann", 1582 | "email": "sebastian@phpunit.de" 1583 | }, 1584 | { 1585 | "name": "Adam Harvey", 1586 | "email": "aharvey@php.net" 1587 | } 1588 | ], 1589 | "description": "Provides functionality to recursively process PHP variables", 1590 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1591 | "time": "2017-03-03T06:23:57+00:00" 1592 | }, 1593 | { 1594 | "name": "sebastian/resource-operations", 1595 | "version": "1.0.0", 1596 | "source": { 1597 | "type": "git", 1598 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1599 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" 1600 | }, 1601 | "dist": { 1602 | "type": "zip", 1603 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1604 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1605 | "shasum": "" 1606 | }, 1607 | "require": { 1608 | "php": ">=5.6.0" 1609 | }, 1610 | "type": "library", 1611 | "extra": { 1612 | "branch-alias": { 1613 | "dev-master": "1.0.x-dev" 1614 | } 1615 | }, 1616 | "autoload": { 1617 | "classmap": [ 1618 | "src/" 1619 | ] 1620 | }, 1621 | "notification-url": "https://packagist.org/downloads/", 1622 | "license": [ 1623 | "BSD-3-Clause" 1624 | ], 1625 | "authors": [ 1626 | { 1627 | "name": "Sebastian Bergmann", 1628 | "email": "sebastian@phpunit.de" 1629 | } 1630 | ], 1631 | "description": "Provides a list of PHP built-in functions that operate on resources", 1632 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1633 | "time": "2015-07-28T20:34:47+00:00" 1634 | }, 1635 | { 1636 | "name": "sebastian/version", 1637 | "version": "2.0.1", 1638 | "source": { 1639 | "type": "git", 1640 | "url": "https://github.com/sebastianbergmann/version.git", 1641 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" 1642 | }, 1643 | "dist": { 1644 | "type": "zip", 1645 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", 1646 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", 1647 | "shasum": "" 1648 | }, 1649 | "require": { 1650 | "php": ">=5.6" 1651 | }, 1652 | "type": "library", 1653 | "extra": { 1654 | "branch-alias": { 1655 | "dev-master": "2.0.x-dev" 1656 | } 1657 | }, 1658 | "autoload": { 1659 | "classmap": [ 1660 | "src/" 1661 | ] 1662 | }, 1663 | "notification-url": "https://packagist.org/downloads/", 1664 | "license": [ 1665 | "BSD-3-Clause" 1666 | ], 1667 | "authors": [ 1668 | { 1669 | "name": "Sebastian Bergmann", 1670 | "email": "sebastian@phpunit.de", 1671 | "role": "lead" 1672 | } 1673 | ], 1674 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1675 | "homepage": "https://github.com/sebastianbergmann/version", 1676 | "time": "2016-10-03T07:35:21+00:00" 1677 | }, 1678 | { 1679 | "name": "squizlabs/php_codesniffer", 1680 | "version": "3.5.4", 1681 | "source": { 1682 | "type": "git", 1683 | "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", 1684 | "reference": "dceec07328401de6211037abbb18bda423677e26" 1685 | }, 1686 | "dist": { 1687 | "type": "zip", 1688 | "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26", 1689 | "reference": "dceec07328401de6211037abbb18bda423677e26", 1690 | "shasum": "" 1691 | }, 1692 | "require": { 1693 | "ext-simplexml": "*", 1694 | "ext-tokenizer": "*", 1695 | "ext-xmlwriter": "*", 1696 | "php": ">=5.4.0" 1697 | }, 1698 | "require-dev": { 1699 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" 1700 | }, 1701 | "bin": [ 1702 | "bin/phpcs", 1703 | "bin/phpcbf" 1704 | ], 1705 | "type": "library", 1706 | "extra": { 1707 | "branch-alias": { 1708 | "dev-master": "3.x-dev" 1709 | } 1710 | }, 1711 | "notification-url": "https://packagist.org/downloads/", 1712 | "license": [ 1713 | "BSD-3-Clause" 1714 | ], 1715 | "authors": [ 1716 | { 1717 | "name": "Greg Sherwood", 1718 | "role": "lead" 1719 | } 1720 | ], 1721 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", 1722 | "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", 1723 | "keywords": [ 1724 | "phpcs", 1725 | "standards" 1726 | ], 1727 | "time": "2020-01-30T22:20:29+00:00" 1728 | }, 1729 | { 1730 | "name": "symfony/polyfill-ctype", 1731 | "version": "v1.13.1", 1732 | "source": { 1733 | "type": "git", 1734 | "url": "https://github.com/symfony/polyfill-ctype.git", 1735 | "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" 1736 | }, 1737 | "dist": { 1738 | "type": "zip", 1739 | "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", 1740 | "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", 1741 | "shasum": "" 1742 | }, 1743 | "require": { 1744 | "php": ">=5.3.3" 1745 | }, 1746 | "suggest": { 1747 | "ext-ctype": "For best performance" 1748 | }, 1749 | "type": "library", 1750 | "extra": { 1751 | "branch-alias": { 1752 | "dev-master": "1.13-dev" 1753 | } 1754 | }, 1755 | "autoload": { 1756 | "psr-4": { 1757 | "Symfony\\Polyfill\\Ctype\\": "" 1758 | }, 1759 | "files": [ 1760 | "bootstrap.php" 1761 | ] 1762 | }, 1763 | "notification-url": "https://packagist.org/downloads/", 1764 | "license": [ 1765 | "MIT" 1766 | ], 1767 | "authors": [ 1768 | { 1769 | "name": "Gert de Pagter", 1770 | "email": "BackEndTea@gmail.com" 1771 | }, 1772 | { 1773 | "name": "Symfony Community", 1774 | "homepage": "https://symfony.com/contributors" 1775 | } 1776 | ], 1777 | "description": "Symfony polyfill for ctype functions", 1778 | "homepage": "https://symfony.com", 1779 | "keywords": [ 1780 | "compatibility", 1781 | "ctype", 1782 | "polyfill", 1783 | "portable" 1784 | ], 1785 | "time": "2019-11-27T13:56:44+00:00" 1786 | }, 1787 | { 1788 | "name": "theseer/tokenizer", 1789 | "version": "1.1.3", 1790 | "source": { 1791 | "type": "git", 1792 | "url": "https://github.com/theseer/tokenizer.git", 1793 | "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" 1794 | }, 1795 | "dist": { 1796 | "type": "zip", 1797 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", 1798 | "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", 1799 | "shasum": "" 1800 | }, 1801 | "require": { 1802 | "ext-dom": "*", 1803 | "ext-tokenizer": "*", 1804 | "ext-xmlwriter": "*", 1805 | "php": "^7.0" 1806 | }, 1807 | "type": "library", 1808 | "autoload": { 1809 | "classmap": [ 1810 | "src/" 1811 | ] 1812 | }, 1813 | "notification-url": "https://packagist.org/downloads/", 1814 | "license": [ 1815 | "BSD-3-Clause" 1816 | ], 1817 | "authors": [ 1818 | { 1819 | "name": "Arne Blankerts", 1820 | "email": "arne@blankerts.de", 1821 | "role": "Developer" 1822 | } 1823 | ], 1824 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 1825 | "time": "2019-06-13T22:48:21+00:00" 1826 | }, 1827 | { 1828 | "name": "webmozart/assert", 1829 | "version": "1.6.0", 1830 | "source": { 1831 | "type": "git", 1832 | "url": "https://github.com/webmozart/assert.git", 1833 | "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" 1834 | }, 1835 | "dist": { 1836 | "type": "zip", 1837 | "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", 1838 | "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", 1839 | "shasum": "" 1840 | }, 1841 | "require": { 1842 | "php": "^5.3.3 || ^7.0", 1843 | "symfony/polyfill-ctype": "^1.8" 1844 | }, 1845 | "conflict": { 1846 | "vimeo/psalm": "<3.6.0" 1847 | }, 1848 | "require-dev": { 1849 | "phpunit/phpunit": "^4.8.36 || ^7.5.13" 1850 | }, 1851 | "type": "library", 1852 | "autoload": { 1853 | "psr-4": { 1854 | "Webmozart\\Assert\\": "src/" 1855 | } 1856 | }, 1857 | "notification-url": "https://packagist.org/downloads/", 1858 | "license": [ 1859 | "MIT" 1860 | ], 1861 | "authors": [ 1862 | { 1863 | "name": "Bernhard Schussek", 1864 | "email": "bschussek@gmail.com" 1865 | } 1866 | ], 1867 | "description": "Assertions to validate method input/output with nice error messages.", 1868 | "keywords": [ 1869 | "assert", 1870 | "check", 1871 | "validate" 1872 | ], 1873 | "time": "2019-11-24T13:36:37+00:00" 1874 | }, 1875 | { 1876 | "name": "wp-coding-standards/wpcs", 1877 | "version": "2.2.1", 1878 | "source": { 1879 | "type": "git", 1880 | "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", 1881 | "reference": "b5a453203114cc2284b1a614c4953456fbe4f546" 1882 | }, 1883 | "dist": { 1884 | "type": "zip", 1885 | "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546", 1886 | "reference": "b5a453203114cc2284b1a614c4953456fbe4f546", 1887 | "shasum": "" 1888 | }, 1889 | "require": { 1890 | "php": ">=5.4", 1891 | "squizlabs/php_codesniffer": "^3.3.1" 1892 | }, 1893 | "require-dev": { 1894 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", 1895 | "phpcompatibility/php-compatibility": "^9.0", 1896 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" 1897 | }, 1898 | "suggest": { 1899 | "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." 1900 | }, 1901 | "type": "phpcodesniffer-standard", 1902 | "notification-url": "https://packagist.org/downloads/", 1903 | "license": [ 1904 | "MIT" 1905 | ], 1906 | "authors": [ 1907 | { 1908 | "name": "Contributors", 1909 | "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" 1910 | } 1911 | ], 1912 | "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", 1913 | "keywords": [ 1914 | "phpcs", 1915 | "standards", 1916 | "wordpress" 1917 | ], 1918 | "time": "2020-02-04T02:52:06+00:00" 1919 | } 1920 | ], 1921 | "aliases": [], 1922 | "minimum-stability": "stable", 1923 | "stability-flags": [], 1924 | "prefer-stable": false, 1925 | "prefer-lowest": false, 1926 | "platform": { 1927 | "php": ">=5.6" 1928 | }, 1929 | "platform-dev": [] 1930 | } 1931 | -------------------------------------------------------------------------------- /phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | . 37 | 38 | 39 | 40 | 41 | tests/* 42 | vendor/* 43 | 44 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | ./tests/ 13 | 14 | 15 | 16 | 17 | ./src 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Response.php: -------------------------------------------------------------------------------- 1 | add_error( 'Wrong nonce' ); 36 | if ( $send ) { 37 | $this->send(); 38 | } 39 | } 40 | } 41 | 42 | /** 43 | * Adds error to the response 44 | * 45 | * @since 1.0.0 46 | * @param string $message Error message, optional. 47 | * @return $this 48 | */ 49 | public function add_error( $message = '' ) { 50 | $this->errors[] = $message; 51 | return $this; 52 | } 53 | 54 | /** 55 | * Gets all errors 56 | * 57 | * @since 1.0.0 58 | * @return array 59 | */ 60 | public function get_errors() { 61 | return $this->errors; 62 | } 63 | 64 | /** 65 | * Sends the error 66 | * 67 | * @since 1.0.0 68 | * @param string $message Error message, optional. 69 | * @return void 70 | */ 71 | public function error( $message = '' ) { 72 | $this->add_error( $message )->send(); 73 | } 74 | 75 | /** 76 | * Sends the response 77 | * 78 | * @since 1.0.0 79 | * @param mixed $success_message Success message. 80 | * Default: null. 81 | * @return void 82 | */ 83 | public function send( $success_message = null ) { 84 | 85 | $errors = $this->get_errors(); 86 | 87 | if ( ! empty( $errors ) ) { 88 | wp_send_json_error( $errors ); 89 | } 90 | 91 | wp_send_json_success( $success_message ); 92 | 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | response = new Response(); 23 | } 24 | 25 | public function tearDown() { 26 | parent::tearDown(); 27 | Mock::disableAll(); 28 | } 29 | 30 | public function test_add_error_should_add_1_error_and_return_self() { 31 | 32 | $errors = [ 33 | 'Err message', 34 | ]; 35 | 36 | $returned = $this->response->add_error( 'Err message' ); 37 | 38 | $this->assertSame( $errors, $this->response->get_errors() ); 39 | $this->assertSame( $this->response, $returned ); 40 | 41 | } 42 | 43 | public function test_add_error_should_add_2_errors() { 44 | 45 | $errors = [ 46 | 'Err message 1', 47 | uniqid(), 48 | ]; 49 | 50 | foreach ( $errors as $error ) { 51 | $this->response->add_error( $error ); 52 | } 53 | 54 | $this->assertSame( $errors, $this->response->get_errors() ); 55 | 56 | } 57 | 58 | /** 59 | * @doesNotPerformAssertions 60 | */ 61 | public function test_send_should_send_success_if_no_errors() { 62 | 63 | $wp_send_json_success = $this->getFunctionMock( 'Micropackage\Ajax', 'wp_send_json_success' ); 64 | $wp_send_json_success->expects( $this->once() )->willReturn( true ); 65 | 66 | $this->response->send(); 67 | 68 | } 69 | 70 | /** 71 | * @expectedException \Exception 72 | */ 73 | public function test_send_should_send_error_if_one_error_added() { 74 | 75 | $wp_send_json_error = $this->getFunctionMock( 'Micropackage\Ajax', 'wp_send_json_error' ); 76 | $wp_send_json_error->expects( $this->once() )->will( $this->throwException( new \Exception() ) ); 77 | 78 | $this->response->add_error( 'Err message' )->send(); 79 | 80 | } 81 | 82 | /** 83 | * @expectedException \Exception 84 | */ 85 | public function test_should_bail_if_nonce_not_verified() { 86 | 87 | $check_ajax_referer = $this->getFunctionMock( 'Micropackage\Ajax', 'check_ajax_referer' ); 88 | $check_ajax_referer->expects( $this->once() )->willReturn( false ); 89 | 90 | $wp_send_json_error = $this->getFunctionMock( 'Micropackage\Ajax', 'wp_send_json_error' ); 91 | $wp_send_json_error->expects( $this->once() )->will( $this->throwException( new \Exception() ) ); 92 | 93 | $this->response->verify_nonce(); 94 | 95 | } 96 | 97 | /** 98 | * @doesNotPerformAssertions 99 | */ 100 | public function test_should_verify_nonce() { 101 | 102 | $check_ajax_referer = $this->getFunctionMock( 'Micropackage\Ajax', 'check_ajax_referer' ); 103 | $check_ajax_referer->expects( $this->once() )->willReturn( true ); 104 | 105 | $wp_send_json_error = $this->getFunctionMock( 'Micropackage\Ajax', 'wp_send_json_error' ); 106 | $wp_send_json_error->expects( $this->never() )->will( $this->throwException( new \Exception() ) ); 107 | 108 | $this->response->verify_nonce(); 109 | 110 | } 111 | 112 | /** 113 | * @expectedException \Exception 114 | */ 115 | public function test_should_send_an_error_immediately() { 116 | 117 | $wp_send_json_error = $this->getFunctionMock( 'Micropackage\Ajax', 'wp_send_json_error' ); 118 | $wp_send_json_error->expects( $this->once() )->will( $this->throwException( new \Exception() ) ); 119 | 120 | $this->response->error( 'Error' ); 121 | 122 | } 123 | 124 | } 125 | --------------------------------------------------------------------------------