Exemplo n.º 1
0
 /**
  * @test
  */
 public function shouldThrowExceptionIfFlagDoesNotExist()
 {
     $mockRepository = $this->getMock('Tx_FeatureFlag_Domain_Repository_FeatureFlag', array('findByFlag'));
     $mockRepository->expects($this->once())->method('findByFlag')->will($this->returnValue(null));
     $this->setService($mockRepository);
     $this->setExpectedException('Tx_FeatureFlag_Service_Exception_FeatureNotFound');
     $this->service->isFeatureEnabled('my_cool_feature');
 }
Exemplo n.º 2
0
 /**
  * Enable or disable features. $features can be a comma-separated list of feature names
  * @param String $features
  */
 private function setFeatureStatus($features, $enabled)
 {
     $features = array_map('trim', explode(',', $features));
     foreach ($features as $feature) {
         echo $feature;
         $this->service->updateFeatureFlag($feature, $enabled);
     }
     $this->service->flagEntries();
 }
Exemplo n.º 3
0
 /**
  * Process request
  * @throws Tx_FeatureFlag_Service_Exception_ActionNotFound
  */
 public function processRequest()
 {
     $action = GeneralUtility::_GP('action');
     $featureName = GeneralUtility::_GP('feature');
     $response = null;
     switch ($action) {
         case 'activate':
             $this->featureFlagService->updateFeatureFlag($featureName, true);
             break;
         case 'deactivate':
             $this->featureFlagService->updateFeatureFlag($featureName, false);
             break;
         case 'flagentries':
             $this->featureFlagService->flagEntries();
             break;
         case 'status':
             $response = $this->featureFlagService->isFeatureEnabled($featureName);
             break;
         default:
             throw new Tx_FeatureFlag_Service_Exception_ActionNotFound('Action not found');
             break;
     }
     echo json_encode(array('status' => 200, 'response' => $response));
 }