dynamic / silverstripe-foxy

BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

REFACTOR Purchasable - setIsAvailable #110

Open jsirish opened 4 years ago

jsirish commented 4 years ago

cache $is_available

jsirish commented 4 years ago

So this works great when testing the FE and CMS, and saves 4 queries on page load.

However, it consistently fails PurchasableTest at the following point: https://github.com/dynamic/silverstripe-foxy/blob/master/tests/Extension/PurchasableTest.php#L113

The test passes if instead of returning $this->is_available I return $this->setIsAvailable() and just return the value of $available vs. setting the static