Opensoft\Rollout\Rollout::defineGroup PHP Метод

defineGroup() публичный Метод

public defineGroup ( string $group, Closure $closure )
$group string
$closure Closure
    public function defineGroup($group, \Closure $closure)
    {
        $this->groups[$group] = $closure;
    }

Usage Example

Пример #1
0
 public function testActivatingAFeatureForAGroupAsAString()
 {
     $this->rollout->defineGroup('admins', function (RolloutUserInterface $user) {
         return $user->getRolloutIdentifier() == 5;
     });
     $this->rollout->activateGroup('chat', 'admins');
     // the feature is active for users for which the block is true
     $this->assertTrue($this->rollout->isActive('chat', new RolloutUser(5)));
     // the feature is not active for users for which the block evaluates to false
     $this->assertFalse($this->rollout->isActive('chat', new RolloutUser(1)));
 }