Increase Mutation Score Indicator (MSI) by creating stronger tests of BaseCollection class

This commit is contained in:
Meritoo
2020-10-24 17:29:50 +02:00
parent 5cd58aec25
commit 8fec0db05f
7 changed files with 113 additions and 47 deletions

View File

@@ -46,13 +46,21 @@ abstract class BaseCollection implements Countable, ArrayAccess, IteratorAggrega
return $elements;
}
/**
* Returns information if given element has valid type
*
* @param mixed $element Element of collection
* @return bool
*/
abstract protected function isValidType($element): bool;
/**
* Returns elements of collection with valid types
*
* @param array $elements The elements of collection to verify
* @return array
*/
protected function getElementsWithValidType(array $elements): array
private function getElementsWithValidType(array $elements): array
{
if (empty($elements)) {
return [];
@@ -70,12 +78,4 @@ abstract class BaseCollection implements Countable, ArrayAccess, IteratorAggrega
return $result;
}
/**
* Returns information if given element has valid type
*
* @param mixed $element Element of collection
* @return bool
*/
abstract protected function isValidType($element): bool;
}