Esempio n. 1
0
 public function testPaging()
 {
     CM_Model_Splitfeature::createStatic(array('name' => 'foo', 'percentage' => 50));
     CM_Model_Splitfeature::createStatic(array('name' => 'bar', 'percentage' => 10));
     $paging = new CM_Paging_Splitfeature_All();
     $this->assertInstanceOf('CM_Model_Splitfeature', $paging->getItem(0));
     $this->assertSame(2, count($paging->getItems()));
     CM_Model_Splitfeature::createStatic(array('name' => 'foobar', 'percentage' => 30));
     $splitfeature = CM_Model_Splitfeature::createStatic(array('name' => 'foofoobar', 'percentage' => 88));
     $paging = new CM_Paging_Splitfeature_All();
     $this->assertSame(4, count($paging->getItems()));
     $splitfeature->delete();
     $paging = new CM_Paging_Splitfeature_All();
     $this->assertSame(3, count($paging->getItems()));
 }
Esempio n. 2
0
 /**
  * @param string        $name
  * @param CM_Model_User $user
  * @return bool
  */
 public static function getEnabledByName($name, CM_Model_User $user)
 {
     $splitfeatureList = new CM_Paging_Splitfeature_All();
     $splitfeature = $splitfeatureList->find($name);
     if (!$splitfeature) {
         return false;
     }
     return $splitfeature->getEnabled($user);
 }