public function test_getUsedTypeIds_shouldReturnAnotherType_IfDifferentOnesAreUsed() { for ($i = 0; $i < 9; $i++) { $this->createMeasurable('website'); $this->createMeasurable('universal'); $this->createMeasurable('mobileapp'); } $this->assertSame(array('website', 'universal', 'mobileapp'), $this->model->getUsedTypeIds()); }
private function getFirstTypeIfOnlyOneIsInUse() { $types = $this->typeManager->getAllTypes(); if (count($types) === 1) { // only one type is in use, use this one for the wording return reset($types); } else { // multiple types are activated, check whether only one is actually in use $model = new Model(); $typeIds = $model->getUsedTypeIds(); if (count($typeIds) === 1) { $typeManager = new TypeManager(); return $typeManager->getType(reset($typeIds)); } } }