Minor linting / style updates

This commit is contained in:
Damian Mooyman 2017-12-11 16:46:21 +13:00
parent 8b429bf47b
commit ee27329728
5 changed files with 12 additions and 12 deletions

View File

@ -4,13 +4,11 @@ namespace SilverStripe\Core\Cache;
/**
* Defines a service that can flush its cache for a list of members
* @package SilverStripe\Core\Cache
*/
interface MemberCacheFlusher
{
/**
* @param null $memberIDs
* @return mixed
* @param array $memberIDs
*/
public function flushMemberCache($memberIDs = null);
}
}

View File

@ -77,7 +77,7 @@ class InheritedPermissionFlusher extends DataExtension implements Flushable
public function flushCache()
{
$ids = $this->getMemberIDList();
foreach ($this->services as $service) {
foreach ($this->getServices() as $service) {
$service->flushMemberCache($ids);
}
}
@ -101,4 +101,4 @@ class InheritedPermissionFlusher extends DataExtension implements Flushable
return [$this->owner->ID];
}
}
}

View File

@ -4,13 +4,12 @@ namespace SilverStripe\Security\Tests;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Core\Cache\CacheFactory;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Security\Group;
use SilverStripe\Security\InheritedPermissionFlusher;
use SilverStripe\Security\Member;
use SilverStripe\Security\Group;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Security\Tests\InheritedPermissionsFlusherTest\TestCacheFlusher;
use SilverStripe\Core\Config\Config;
class InheritedPermissionsFlusherTest extends SapphireTest
{
@ -59,7 +58,9 @@ class InheritedPermissionsFlusherTest extends SapphireTest
$extension = new InheritedPermissionFlusher();
$extension->setServices([$flusher]);
Injector::inst()->registerService($extension, InheritedPermissionFlusher::class);
/** @var Group $editors */
$editors = $this->objFromFixture(Group::class, 'editors');
/** @var Group $admins */
$admins = $this->objFromFixture(Group::class, 'admins');
// Populate the cache for all members in each group
@ -97,4 +98,4 @@ class InheritedPermissionsFlusherTest extends SapphireTest
$this->assertNull($cache->get($editorKey));
}
}
}
}

View File

@ -32,4 +32,4 @@ SilverStripe\Security\Member:
allsections:
Groups: =>SilverStripe\Security\Group.allsections
securityadmin:
Groups: =>SilverStripe\Security\Group.securityadmins
Groups: =>SilverStripe\Security\Group.securityadmins

View File

@ -32,6 +32,7 @@ class TestCacheFlusher implements MemberCacheFlusher
/**
* Clear the cache for this instance only
*
* @param array $memberIDs A list of member IDs
*/
public function flushMemberCache($memberIDs = null)
@ -64,4 +65,4 @@ class TestCacheFlusher implements MemberCacheFlusher
{
return "{$category}__{$memberID}";
}
}
}