Source of file MockState.php
Size: 1,577 Bytes - Last Modified: 2021-12-24T06:47:24+00:00
/var/www/docs.ssmods.com/process/src/tests/mocks/MockState.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | <?php namespace Firesphere\SolrSearch\Tests; use Firesphere\SolrSearch\Interfaces\SiteStateInterface; use Firesphere\SolrSearch\Queries\BaseQuery; use Firesphere\SolrSearch\States\SiteState; use SilverStripe\Dev\TestOnly; class MockState extends SiteState implements TestOnly, SiteStateInterface { public $enabled = false; public function appliesToEnvironment(): bool { return $this->enabled; } /** * Reset the SiteState to it's default state * * @return mixed */ public function setDefaultState($state = null) { $this->activateState('default'); } /** * Activate a given state. This should only be done if the state is applicable * * @param string $state * @return mixed */ public function activateState($state) { $this->state = $state; } /** * Return the current state of the site * * @return string */ public function currentState(): string { return 'default'; } /** * Is this state applicable to this extension * E.g. in case of Fluent, the state "SubsiteID1" does not make sense * * @param string $state * @return bool */ public function stateIsApplicable($state): bool { return in_array($state, ['default', 'other']); } /** * Method to alter the query. Can be no-op. * * @param BaseQuery $query * @return mixed */ public function updateQuery(&$query) { // TODO: Implement updateQuery() method. } } |