Closed ovidiul closed 3 years ago
Hi Gary, I've rebased my PR and added the requested changes.
Let me know if you see further adjustments needed.
Looking better, but I'm still not seeing a test that checks that update_option() was only called once when
$capability->register()
called twice. Have a look at brain-wp.github.io/BrainMonkey/docs/functions-expect.html which allows you to test for exactly this. Set theFunction\expects
, ensure the saved option is empty, call register twice, and see if the test is green (Might need to put that into a unit test, rather than the integration test)
I've added a unit test in tests/unit/CapabilityTest.php
We do have a related test in tests/integration/CapabilityTest.php
, method test_register
which checks the return of the register method, I guess another one doesn't hurt.
I've squashed all of the commits, and rebased on to develop
, so we'll have a clean history.
It fixes the issue mentioned in #77 by renaming the activation hook to admin_init and adding a version check to only init the roles once when the version changes as per https://docs.wpvip.com/how-tos/customize-user-roles/ .
PR #93 might need to be merged before this.