mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Increase Mutation Score Indicator (MSI) by creating stronger tests of BaseCollection class
This commit is contained in:
42
tests/Collection/BaseCollection/FirstNamesCollection.php
Normal file
42
tests/Collection/BaseCollection/FirstNamesCollection.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Meritoo\Test\Common\Collection\BaseCollection;
|
||||
|
||||
use Meritoo\Common\Collection\BaseCollection;
|
||||
|
||||
/**
|
||||
* Collection of first names
|
||||
*
|
||||
* @author Meritoo <github@meritoo.pl>
|
||||
* @copyright Meritoo <http://www.meritoo.pl>
|
||||
*
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class FirstNamesCollection extends BaseCollection
|
||||
{
|
||||
protected function isValidType($element): bool
|
||||
{
|
||||
return $element instanceof User;
|
||||
}
|
||||
|
||||
protected function prepareElements(array $elements): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
/** @var User $element */
|
||||
foreach ($elements as $element) {
|
||||
$result[] = $element->getFirstName();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user