mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Remove usage of Functional\map function
This commit is contained in:
@@ -18,7 +18,7 @@ use Shlinkio\Shlink\Core\ShortUrl\ShortUrlResolverInterface;
|
||||
use Shlinkio\Shlink\Core\Visit\Entity\Visit;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\Visitor;
|
||||
|
||||
use function Functional\map;
|
||||
use function array_map;
|
||||
use function range;
|
||||
use function sprintf;
|
||||
|
||||
@@ -31,7 +31,7 @@ class DeleteShortUrlServiceTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
$shortUrl = ShortUrl::createFake()->setVisits(new ArrayCollection(
|
||||
map(range(0, 10), fn () => Visit::forValidShortUrl(ShortUrl::createFake(), Visitor::emptyInstance())),
|
||||
array_map(fn () => Visit::forValidShortUrl(ShortUrl::createFake(), Visitor::emptyInstance()), range(0, 10)),
|
||||
));
|
||||
$this->shortCode = $shortUrl->getShortCode();
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ use Shlinkio\Shlink\Core\ShortUrl\Model\Validation\ShortUrlInputFilter;
|
||||
use Shlinkio\Shlink\Importer\Model\ImportedShlinkUrl;
|
||||
use Shlinkio\Shlink\Importer\Sources\ImportSource;
|
||||
|
||||
use function array_map;
|
||||
use function Functional\every;
|
||||
use function Functional\map;
|
||||
use function range;
|
||||
use function strlen;
|
||||
use function strtolower;
|
||||
@@ -88,7 +88,7 @@ class ShortUrlTest extends TestCase
|
||||
public static function provideLengths(): iterable
|
||||
{
|
||||
yield [null, DEFAULT_SHORT_CODES_LENGTH];
|
||||
yield from map(range(4, 10), fn (int $value) => [$value, $value]);
|
||||
yield from array_map(fn (int $value) => [$value, $value], range(4, 10));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
|
||||
@@ -25,7 +25,7 @@ use Shlinkio\Shlink\Core\Visit\Model\Visitor;
|
||||
use Shlinkio\Shlink\Rest\Entity\ApiKey;
|
||||
use ShlinkioTest\Shlink\Core\Util\ApiKeyDataProviders;
|
||||
|
||||
use function Functional\map;
|
||||
use function array_map;
|
||||
use function range;
|
||||
|
||||
class ShortUrlResolverTest extends TestCase
|
||||
@@ -113,9 +113,9 @@ class ShortUrlResolverTest extends TestCase
|
||||
$shortUrl = ShortUrl::create(
|
||||
ShortUrlCreation::fromRawData(['maxVisits' => 3, 'longUrl' => 'https://longUrl']),
|
||||
);
|
||||
$shortUrl->setVisits(new ArrayCollection(map(
|
||||
range(0, 4),
|
||||
$shortUrl->setVisits(new ArrayCollection(array_map(
|
||||
fn () => Visit::forValidShortUrl($shortUrl, Visitor::emptyInstance()),
|
||||
range(0, 4),
|
||||
)));
|
||||
|
||||
return $shortUrl;
|
||||
@@ -132,9 +132,9 @@ class ShortUrlResolverTest extends TestCase
|
||||
'validUntil' => $now->subMonths(1)->toAtomString(),
|
||||
'longUrl' => 'https://longUrl',
|
||||
]));
|
||||
$shortUrl->setVisits(new ArrayCollection(map(
|
||||
range(0, 4),
|
||||
$shortUrl->setVisits(new ArrayCollection(array_map(
|
||||
fn () => Visit::forValidShortUrl($shortUrl, Visitor::emptyInstance()),
|
||||
range(0, 4),
|
||||
)));
|
||||
|
||||
return $shortUrl;
|
||||
|
||||
@@ -84,4 +84,14 @@ class ShortUrlDataTransformerTest extends TestCase
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function properTagsAreReturned(): void
|
||||
{
|
||||
['tags' => $tags] = $this->transformer->transform(ShortUrl::create(ShortUrlCreation::fromRawData([
|
||||
'longUrl' => 'https://longUrl',
|
||||
'tags' => ['foo', 'bar', 'baz'],
|
||||
])));
|
||||
self::assertEquals(['foo', 'bar', 'baz'], $tags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user