mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-27 16:26:37 +03:00
Explicitly required an MSI of 83 for unit tests
This commit is contained in:
parent
0786a962e7
commit
3f3cf5e20e
3 changed files with 38 additions and 3 deletions
|
@ -140,7 +140,7 @@
|
|||
"test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite",
|
||||
"test:api": "bin/test/run-api-tests.sh",
|
||||
"infect:ci:base": "infection --threads=4 --log-verbosity=default --only-covered --only-covering-test-cases --skip-initial-tests",
|
||||
"infect:ci:unit": "@infect:ci:base --coverage=build/coverage-unit --min-msi=80",
|
||||
"infect:ci:unit": "@infect:ci:base --coverage=build/coverage-unit --min-msi=83",
|
||||
"infect:ci:db": "@infect:ci:base --coverage=build/coverage-db --min-msi=95 --configuration=infection-db.json",
|
||||
"infect:ci": "@parallel infect:ci:unit infect:ci:db",
|
||||
"infect:test": [
|
||||
|
|
|
@ -45,13 +45,16 @@ class OrphanVisitsActionTest extends TestCase
|
|||
$orphanVisits = $this->visitsHelper->orphanVisits(Argument::type(VisitsParams::class))->willReturn(
|
||||
new Paginator(new ArrayAdapter($visits)),
|
||||
);
|
||||
$visitsAmount = count($visits);
|
||||
$transform = $this->orphanVisitTransformer->transform(Argument::type(Visit::class))->willReturn([]);
|
||||
|
||||
/** @var JsonResponse $response */
|
||||
$response = $this->action->handle(ServerRequestFactory::fromGlobals());
|
||||
$payload = $response->getPayload();
|
||||
|
||||
self::assertInstanceOf(JsonResponse::class, $response);
|
||||
self::assertCount($visitsAmount, $payload['visits']['data']);
|
||||
self::assertEquals(200, $response->getStatusCode());
|
||||
$orphanVisits->shouldHaveBeenCalledOnce();
|
||||
$transform->shouldHaveBeenCalledTimes(count($visits));
|
||||
$transform->shouldHaveBeenCalledTimes($visitsAmount);
|
||||
}
|
||||
}
|
||||
|
|
32
module/Rest/test/ApiKey/Model/RoleDefinitionTest.php
Normal file
32
module/Rest/test/ApiKey/Model/RoleDefinitionTest.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Rest\ApiKey\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Entity\Domain;
|
||||
use Shlinkio\Shlink\Rest\ApiKey\Model\RoleDefinition;
|
||||
use Shlinkio\Shlink\Rest\ApiKey\Role;
|
||||
|
||||
class RoleDefinitionTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function forAuthoredShortUrlsCreatesRoleDefinitionAsExpected(): void
|
||||
{
|
||||
$definition = RoleDefinition::forAuthoredShortUrls();
|
||||
|
||||
self::assertEquals(Role::AUTHORED_SHORT_URLS, $definition->roleName());
|
||||
self::assertEquals([], $definition->meta());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function forDomainCreatesRoleDefinitionAsExpected(): void
|
||||
{
|
||||
$domain = Domain::withAuthority('foo.com')->setId('123');
|
||||
$definition = RoleDefinition::forDomain($domain);
|
||||
|
||||
self::assertEquals(Role::DOMAIN_SPECIFIC, $definition->roleName());
|
||||
self::assertEquals(['domain_id' => '123', 'authority' => 'foo.com'], $definition->meta());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue