[Sprint/GiddyGiraffe](feat): Add in delegate for checking for onchain badge
Closes #493
This change, when an onchain boost is accepted, should set the users newfound onchain_booster variable to the (current Unix timestamp + 1 week).
This is to be digested by the front-end to determine whether or not to show the onchain booster badge on a users profile.
Ideally this would be tested on a seperate domain before public release.
added 1 commit
- b47d4b3d - Moved to delegate, and only triggering on one tx
added 2 commits
added 2 commits
changed title from WIP: Add in event for checking for onchain badge to WIP: Add in delegate for checking for onchain badge
added 2 commits
- Resolved by Ben Hayward
- Resolved by Ben Hayward
- Resolved by Ben Hayward
- Last updated by Ben Hayward
15 16 class OnchainBadgeSpec extends ObjectBehavior 17 { 18 19 function it_is_initializable() 20 { 21 $this->shouldHaveType(OnchainBadge::class); 22 } 23 24 function it_should_update_a_users_plus_badge_expiry(Boost $boost, User $user) 25 { 26 $boost->getOwner() 27 ->shouldBeCalled() 28 ->willReturn($user); 29 30 $user->setOnchainBooster(Argument::any()) - Owner
should we not check the time is set correctly?
changed this line in version 12 of the diff
- Developer
I test this in the User entities spec tests here:
- Owner
Needs to be tested at the unit level too.
- Developer
Not certain how to go about that - will chat tomorrow if you need it; from what I can see the coverage is 100% and I'm not quite sure how to access the user object in such a way given PHPSpecs lack of assert.
- Resolved by Ben Hayward
- Resolved by Ben Hayward
- Resolved by Ben Hayward
changed title from WIP: Add in delegate for checking for onchain badge to WIP: {+Sprint/GiddyGiraffe: +}Add in delegate for checking for onchain badge
changed the description
- Resolved by Ben Hayward
- Resolved by Ben Hayward
- Last updated by Ben Hayward
1047 1047 return "urn:user:{$this->getGuid()}"; 1048 1048 } 1049 1049 1050 /** 1051 * Returns whether the user has onchain_booster status. 1052 * @return boolean true if the date set in onchain_booster is larger than the current time. 1053 */ 1054 public function isOnchainBooster() 1055 { 1056 return (boolean) (time() < $this->onchain_booster); - Owner
boolean is an alias. bool should ideally be used. aliases blow up when used a typehints so we should avoid.
- Developer
Thanks, was unaware of that, have amended.
approved this merge request
unmarked as a Work In Progress