Release 2.25 (#5109)
This commit is contained in:
@@ -225,7 +225,7 @@ abstract class APIControllerBaseTest extends ControllerBaseTest
|
||||
if (\count($globalError) > 0) {
|
||||
self::assertArrayHasKey('errors', $result['errors']);
|
||||
foreach ($globalError as $err) {
|
||||
self::assertTrue(\in_array($err, $result['errors']['errors']), 'Missing global validation error: ' . $err);
|
||||
self::assertTrue(\in_array($err, $result['errors']['errors']), 'Missing global validation error: ' . $err); // @phpstan-ignore binaryOp.invalid
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,13 @@ class ActionsControllerTest extends APIControllerBaseTest
|
||||
|
||||
$this->assertIsArray($result);
|
||||
foreach ($result as $item) {
|
||||
self::assertIsArray($item);
|
||||
self::assertApiResponseTypeStructure('PageActionItem', $item);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($entries as $id) {
|
||||
self::assertIsArray($result[$i]);
|
||||
self::assertEquals($id, $result[$i]['id'], \sprintf('Failed action "%s" with name "%s" in view "%s"', $i, $id, $view));
|
||||
$i++;
|
||||
}
|
||||
@@ -110,11 +112,13 @@ class ActionsControllerTest extends APIControllerBaseTest
|
||||
|
||||
$this->assertIsArray($result);
|
||||
foreach ($result as $item) {
|
||||
self::assertIsArray($item);
|
||||
self::assertApiResponseTypeStructure('PageActionItem', $item);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($entries as $id) {
|
||||
self::assertIsArray($result[$i]);
|
||||
self::assertEquals($id, $result[$i]['id'], \sprintf('Failed action "%s" with name "%s" in view "%s"', $i, $id, $view));
|
||||
$i++;
|
||||
}
|
||||
@@ -159,11 +163,13 @@ class ActionsControllerTest extends APIControllerBaseTest
|
||||
|
||||
$this->assertIsArray($result);
|
||||
foreach ($result as $item) {
|
||||
self::assertIsArray($item);
|
||||
self::assertApiResponseTypeStructure('PageActionItem', $item);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($entries as $id) {
|
||||
self::assertIsArray($result[$i]);
|
||||
self::assertEquals($id, $result[$i]['id'], \sprintf('Failed action "%s" with name "%s" in view "%s"', $i, $id, $view));
|
||||
$i++;
|
||||
}
|
||||
@@ -204,11 +210,13 @@ class ActionsControllerTest extends APIControllerBaseTest
|
||||
|
||||
$this->assertIsArray($result);
|
||||
foreach ($result as $item) {
|
||||
self::assertIsArray($item);
|
||||
self::assertApiResponseTypeStructure('PageActionItem', $item);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($entries as $id) {
|
||||
self::assertIsArray($result[$i]);
|
||||
self::assertEquals($id, $result[$i]['id'], \sprintf('Failed action "%s" with name "%s" in view "%s"', $i, $id, $view));
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ use App\Repository\ActivityRateRepository;
|
||||
use App\Repository\ActivityRepository;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
use App\Tests\Mocks\ActivityTestMetaFieldSubscriberMock;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
@@ -179,6 +180,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
for ($i = 0; $i < \count($result); $i++) {
|
||||
$activity = $result[$i];
|
||||
$hasProject = $expected[$i][0];
|
||||
self::assertIsArray($activity);
|
||||
self::assertApiResponseTypeStructure('ActivityCollection', $activity);
|
||||
if ($hasProject && $projectId !== null) {
|
||||
$this->assertEquals($projectId, $activity['project']);
|
||||
@@ -219,6 +221,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(5, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('ActivityCollection', $result[0]);
|
||||
$this->assertEquals($imports[0]->getId(), $result[4]['project']);
|
||||
$this->assertEquals($imports[1]->getId(), $result[3]['project']);
|
||||
@@ -429,7 +432,9 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
public function testMetaAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
static::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = static::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new ActivityTestMetaFieldSubscriberMock());
|
||||
|
||||
$data = [
|
||||
'name' => 'metatestmock',
|
||||
|
||||
@@ -20,7 +20,6 @@ use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Authentication\TokenAuthenticator
|
||||
@@ -118,7 +117,6 @@ class TokenAuthenticatorTest extends TestCase
|
||||
|
||||
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo2', 'HTTP_X-AUTH-TOKEN' => 'bar']);
|
||||
$passport = $sut->authenticate($request);
|
||||
self::assertInstanceOf(Passport::class, $passport);
|
||||
$badge = $passport->getBadge(UserBadge::class);
|
||||
self::assertInstanceOf(UserBadge::class, $badge);
|
||||
self::assertEquals('foo2', $badge->getUserIdentifier());
|
||||
|
||||
@@ -21,6 +21,7 @@ use App\Entity\User;
|
||||
use App\Repository\CustomerRateRepository;
|
||||
use App\Repository\CustomerRepository;
|
||||
use App\Tests\Mocks\CustomerTestMetaFieldSubscriberMock;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
@@ -104,6 +105,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(1, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('CustomerCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -120,6 +122,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(1, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('CustomerCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -372,7 +375,9 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
public function testMetaAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = static::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new CustomerTestMetaFieldSubscriberMock());
|
||||
|
||||
$data = [
|
||||
'name' => 'metatestmock',
|
||||
|
||||
@@ -51,6 +51,7 @@ class InvoiceControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(10, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('InvoiceCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -72,6 +73,7 @@ class InvoiceControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(7, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('InvoiceCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -91,6 +93,7 @@ class InvoiceControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(4, \count($result));
|
||||
$this->assertPagination($client->getResponse(), 2, 4, 5, 20);
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('InvoiceCollection', $result[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ use App\Repository\ProjectRateRepository;
|
||||
use App\Repository\ProjectRepository;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
use App\Tests\Mocks\ProjectTestMetaFieldSubscriberMock;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
@@ -105,6 +106,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(1, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('ProjectCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -219,6 +221,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
|
||||
for ($i = 0; $i < \count($expected); $i++) {
|
||||
$project = $result[$i];
|
||||
self::assertIsArray($project);
|
||||
self::assertApiResponseTypeStructure('ProjectCollection', $project);
|
||||
if ($customerId !== null) {
|
||||
$this->assertEquals($customerId, $project['customer']);
|
||||
@@ -579,7 +582,9 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
public function testMetaAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = static::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new ProjectTestMetaFieldSubscriberMock());
|
||||
|
||||
$data = [
|
||||
'name' => 'metatestmock',
|
||||
|
||||
@@ -150,7 +150,13 @@ trait RateControllerTestTrait
|
||||
$this->assertEquals(\count($expectedRates), \count($result));
|
||||
|
||||
foreach ($result as $rate) {
|
||||
$this->assertRateStructure($rate, ($rate['user'] === null ? null : $rate['user']['id']));
|
||||
$this->assertIsArray($rate);
|
||||
if ($rate['user'] === null) {
|
||||
$this->assertRateStructure($rate);
|
||||
} else {
|
||||
$this->assertIsArray($rate['user']);
|
||||
$this->assertRateStructure($rate, $rate['user']['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(3, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TagEntity', $result[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
self::assertEquals(2, \count($result));
|
||||
self::assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TeamCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -152,7 +153,9 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$updateId = $result['id'];
|
||||
$this->assertIsNumeric($updateId);
|
||||
|
||||
$data = [
|
||||
'name' => 'foo',
|
||||
@@ -171,14 +174,17 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertNotEmpty($result['id']);
|
||||
self::assertCount(3, $result['members']);
|
||||
$this->assertIsNumeric($updateId);
|
||||
|
||||
$this->request($client, '/api/teams/' . $updateId);
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['members']);
|
||||
self::assertCount(3, $result['members']);
|
||||
|
||||
$this->assertIsArray($result['members'][1]);
|
||||
self::assertFalse($result['members'][1]['teamlead']);
|
||||
self::assertEquals(1, $result['members'][1]['user']['id']);
|
||||
self::assertEquals('clara_customer', $result['members'][1]['user']['username']);
|
||||
@@ -187,7 +193,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertEquals(4, $result['members'][2]['user']['id']);
|
||||
self::assertEquals('tony_teamlead', $result['members'][2]['user']['username']);
|
||||
|
||||
self::assertTrue(true, $result['members'][0]['teamlead']);
|
||||
self::assertTrue($result['members'][0]['teamlead']);
|
||||
self::assertEquals(2, $result['members'][0]['user']['id']);
|
||||
self::assertEquals('john_user', $result['members'][0]['user']['username']);
|
||||
}
|
||||
@@ -204,6 +210,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
$data = [
|
||||
'name' => '1',
|
||||
@@ -230,6 +238,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertNotEmpty($result['id']);
|
||||
$id = $result['id'];
|
||||
$this->assertIsNumeric($id);
|
||||
|
||||
$this->request($client, '/api/teams/' . $id, 'DELETE');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -249,7 +258,10 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result['members']);
|
||||
self::assertCount(1, $result['members']);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/members/2', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -257,6 +269,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['members']);
|
||||
self::assertCount(2, $result['members']);
|
||||
}
|
||||
|
||||
@@ -273,6 +286,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertEntityNotFoundForPost($client, '/api/teams/999/members/999');
|
||||
@@ -303,6 +318,9 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
$this->assertIsArray($result['members']);
|
||||
self::assertCount(4, $result['members']);
|
||||
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/members/2', 'DELETE');
|
||||
@@ -311,6 +329,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['members']);
|
||||
self::assertCount(3, $result['members']);
|
||||
}
|
||||
|
||||
@@ -329,6 +348,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertNotFoundForDelete($client, '/api/teams/999/members/999');
|
||||
@@ -359,6 +380,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(0, $result['customers']);
|
||||
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST');
|
||||
@@ -367,7 +390,9 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['customers']);
|
||||
self::assertCount(1, $result['customers']);
|
||||
$this->assertIsArray($result['customers'][0]);
|
||||
self::assertEquals(1, $result['customers'][0]['id']);
|
||||
}
|
||||
|
||||
@@ -384,6 +409,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertEntityNotFoundForPost($client, '/api/teams/999/customers/999');
|
||||
@@ -395,6 +422,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(1, $result['customers']);
|
||||
|
||||
// cannot add existing customer
|
||||
@@ -416,12 +445,16 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(0, $result['customers']);
|
||||
|
||||
// add customer
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(1, $result['customers']);
|
||||
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/customers/1', 'DELETE');
|
||||
@@ -429,7 +462,10 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['customers']);
|
||||
self::assertCount(0, $result['customers']);
|
||||
|
||||
/** @var EntityManager $em */
|
||||
@@ -454,6 +490,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertNotFoundForDelete($client, '/api/teams/999/customers/999');
|
||||
@@ -477,6 +515,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(0, $result['projects']);
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -484,7 +524,9 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['projects']);
|
||||
self::assertCount(1, $result['projects']);
|
||||
$this->assertIsArray($result['projects'][0]);
|
||||
self::assertEquals(1, $result['projects'][0]['id']);
|
||||
}
|
||||
|
||||
@@ -501,6 +543,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertEntityNotFoundForPost($client, '/api/teams/999/projects/999');
|
||||
@@ -514,6 +558,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(1, $result['projects']);
|
||||
|
||||
// cannot add existing project
|
||||
@@ -535,12 +581,16 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(0, $result['projects']);
|
||||
|
||||
// add project
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result['projects']);
|
||||
self::assertCount(1, $result['projects']);
|
||||
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/projects/1', 'DELETE');
|
||||
@@ -549,6 +599,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['projects']);
|
||||
self::assertCount(0, $result['projects']);
|
||||
|
||||
/** @var EntityManager $em */
|
||||
@@ -573,6 +624,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertNotFoundForDelete($client, '/api/teams/999/projects/999');
|
||||
@@ -596,6 +649,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(0, $result['activities']);
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
@@ -603,7 +658,9 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['activities']);
|
||||
self::assertCount(1, $result['activities']);
|
||||
$this->assertIsArray($result['activities'][0]);
|
||||
self::assertEquals(1, $result['activities'][0]['id']);
|
||||
}
|
||||
|
||||
@@ -620,6 +677,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertEntityNotFoundForPost($client, '/api/teams/999/activities/999');
|
||||
@@ -631,6 +690,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(1, $result['activities']);
|
||||
|
||||
// cannot add existing activity
|
||||
@@ -652,12 +713,16 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result['activities']);
|
||||
self::assertCount(0, $result['activities']);
|
||||
|
||||
// add activity
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
self::assertCount(1, $result['activities']);
|
||||
|
||||
$this->request($client, '/api/teams/' . $result['id'] . '/activities/1', 'DELETE');
|
||||
@@ -666,6 +731,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
$this->assertIsArray($result['activities']);
|
||||
self::assertCount(0, $result['activities']);
|
||||
}
|
||||
|
||||
@@ -684,6 +750,8 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->request($client, '/api/teams', 'POST', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsNumeric($result['id']);
|
||||
|
||||
// team not found
|
||||
$this->assertNotFoundForDelete($client, '/api/teams/999/activities/9999');
|
||||
|
||||
@@ -20,6 +20,7 @@ use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use App\Tests\Mocks\TimesheetTestMetaFieldSubscriberMock;
|
||||
use App\Timesheet\DateTimeFactory;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
@@ -63,6 +64,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -79,6 +81,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollectionFull', $result[0]);
|
||||
}
|
||||
|
||||
@@ -103,6 +106,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
|
||||
$query = ['users' => [2]];
|
||||
@@ -115,6 +119,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -162,6 +167,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -186,6 +192,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(17, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -237,6 +244,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(4, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -289,6 +297,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(5, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -324,6 +333,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(7, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
|
||||
$query = [
|
||||
@@ -342,6 +352,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
|
||||
$query = [
|
||||
@@ -358,6 +369,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(17, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -896,6 +908,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TimesheetEntity', $result);
|
||||
self::assertNotEmpty($result['id']);
|
||||
self::assertIsNumeric($result['id']);
|
||||
$id = $result['id'];
|
||||
|
||||
$this->request($client, '/api/timesheets/' . $id, 'DELETE');
|
||||
@@ -999,6 +1012,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(1, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollectionFull', $result[0]);
|
||||
}
|
||||
|
||||
@@ -1024,6 +1038,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
|
||||
self::assertEquals(3, \count($result));
|
||||
foreach ($result as $timesheet) {
|
||||
$this->assertIsArray($timesheet);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollectionFull', $timesheet);
|
||||
}
|
||||
}
|
||||
@@ -1142,6 +1157,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
|
||||
$query = ['tags' => ['Test', 'Admin']];
|
||||
@@ -1154,6 +1170,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(10, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
|
||||
$query = ['tags' => ['Nothing-2-see', 'here']];
|
||||
@@ -1166,6 +1183,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsArray($result);
|
||||
self::assertNotEmpty($result);
|
||||
self::assertEquals(20, \count($result));
|
||||
$this->assertIsArray($result[0]);
|
||||
self::assertApiResponseTypeStructure('TimesheetCollection', $result[0]);
|
||||
}
|
||||
|
||||
@@ -1190,6 +1208,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsString($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TimesheetEntity', $result);
|
||||
$this->assertEmpty($result['description']);
|
||||
$this->assertEmpty($result['tags']);
|
||||
@@ -1227,6 +1246,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsString($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TimesheetEntity', $result);
|
||||
$this->assertEmpty($result['description']);
|
||||
$this->assertEmpty($result['tags']);
|
||||
@@ -1272,6 +1292,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsString($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TimesheetEntity', $result);
|
||||
self::assertEquals('foo', $result['description']);
|
||||
self::assertEquals([['name' => 'sdfsdf', 'value' => 'nnnnn'], ['name' => '1234567890', 'value' => '1234567890']], $result['metaFields']);
|
||||
@@ -1342,8 +1363,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertNotEmpty($result['id']);
|
||||
$this->assertTrue($result['duration'] == 28800 || $result['duration'] == 28860); // 1 minute rounding might be applied
|
||||
self::assertEquals(2016, $result['rate']);
|
||||
|
||||
$this->request($client, '/api/timesheets/' . $result['id'] . '/duplicate', 'PATCH');
|
||||
$id = $result['id'];
|
||||
self::assertIsNumeric($id);
|
||||
$this->request($client, '/api/timesheets/' . $id . '/duplicate', 'PATCH');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
@@ -1380,6 +1402,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsString($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TimesheetEntity', $result);
|
||||
|
||||
$em->clear();
|
||||
@@ -1456,7 +1479,9 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$timesheets = $this->importFixtureForUser(User::ROLE_USER);
|
||||
$id = $timesheets[0]->getId();
|
||||
static::getContainer()->get('event_dispatcher')->addSubscriber(new TimesheetTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = static::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new TimesheetTestMetaFieldSubscriberMock());
|
||||
|
||||
$data = [
|
||||
'name' => 'metatestmock',
|
||||
@@ -1472,6 +1497,7 @@ class TimesheetControllerTest extends APIControllerBaseTest
|
||||
self::assertIsString($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TimesheetEntity', $result);
|
||||
self::assertEquals(['name' => 'metatestmock', 'value' => 'another,testing,bar'], $result['metaFields'][0]);
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class UserControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(7, \count($result));
|
||||
foreach ($result as $user) {
|
||||
$this->assertIsArray($user);
|
||||
self::assertApiResponseTypeStructure('UserCollection', $user);
|
||||
}
|
||||
}
|
||||
@@ -70,6 +71,7 @@ class UserControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(7, \count($result));
|
||||
foreach ($result as $user) {
|
||||
$this->assertIsArray($user);
|
||||
self::assertApiResponseTypeStructure('UserEntity', $user);
|
||||
}
|
||||
}
|
||||
@@ -86,6 +88,7 @@ class UserControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(1, \count($result));
|
||||
foreach ($result as $user) {
|
||||
$this->assertIsArray($user);
|
||||
self::assertApiResponseTypeStructure('UserCollection', $user);
|
||||
}
|
||||
}
|
||||
@@ -102,6 +105,7 @@ class UserControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(8, \count($result));
|
||||
foreach ($result as $user) {
|
||||
$this->assertIsArray($user);
|
||||
self::assertApiResponseTypeStructure('UserCollection', $user);
|
||||
}
|
||||
}
|
||||
@@ -283,7 +287,9 @@ class UserControllerTest extends APIControllerBaseTest
|
||||
'ROLE_TEAMLEAD',
|
||||
],
|
||||
];
|
||||
$this->request($client, '/api/users/' . $result['id'], 'PATCH', [], json_encode($data));
|
||||
$id = $result['id'];
|
||||
self::assertIsNumeric($id);
|
||||
$this->request($client, '/api/users/' . $id, 'PATCH', [], json_encode($data));
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
|
||||
@@ -113,11 +113,7 @@ class ActivityServiceTest extends TestCase
|
||||
{
|
||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
|
||||
if ($event instanceof ActivityMetaDefinitionEvent) {
|
||||
self::assertInstanceOf(Activity::class, $event->getEntity());
|
||||
} elseif ($event instanceof ActivityCreateEvent) {
|
||||
self::assertInstanceOf(Activity::class, $event->getActivity());
|
||||
} else {
|
||||
if (!$event instanceof ActivityMetaDefinitionEvent && !$event instanceof ActivityCreateEvent) {
|
||||
$this->fail('Invalid event received');
|
||||
}
|
||||
|
||||
@@ -136,11 +132,7 @@ class ActivityServiceTest extends TestCase
|
||||
{
|
||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
|
||||
if ($event instanceof ActivityCreatePreEvent) {
|
||||
self::assertInstanceOf(Activity::class, $event->getActivity());
|
||||
} elseif ($event instanceof ActivityCreatePostEvent) {
|
||||
self::assertInstanceOf(Activity::class, $event->getActivity());
|
||||
} else {
|
||||
if (!$event instanceof ActivityCreatePreEvent && !$event instanceof ActivityCreatePostEvent) {
|
||||
$this->fail('Invalid event received');
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Command\ActivateUserCommand;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use App\User\UserService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
@@ -33,6 +34,7 @@ class ActivateUserCommandTest extends KernelTestCase
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
/** @var UserService $userService */
|
||||
$userService = $container->get(UserService::class);
|
||||
|
||||
$this->application->add(new ActivateUserCommand($userService));
|
||||
@@ -71,8 +73,10 @@ class ActivateUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] User "chris_user" has been activated.', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('chris_user');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertTrue($user->isEnabled());
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Command\ChangePasswordCommand;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use App\User\UserService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
@@ -35,6 +36,7 @@ class ChangePasswordCommandTest extends KernelTestCase
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
/** @var UserService $userService */
|
||||
$userService = $container->get(UserService::class);
|
||||
|
||||
$this->application->add(new ChangePasswordCommand($userService));
|
||||
@@ -86,8 +88,10 @@ class ChangePasswordCommandTest extends KernelTestCase
|
||||
$output = $commandTester->getDisplay();
|
||||
$this->assertStringContainsString('[OK] Changed password for user "john_user".', $output);
|
||||
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = self::getContainer()->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = self::getContainer()->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('john_user');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Command\CreateUserCommand;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use App\User\UserService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
@@ -31,10 +32,9 @@ class CreateUserCommandTest extends KernelTestCase
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
$this->application->add(new CreateUserCommand(
|
||||
$container->get(UserService::class),
|
||||
));
|
||||
/** @var UserService $userService */
|
||||
$userService = $container->get(UserService::class);
|
||||
$this->application->add(new CreateUserCommand($userService));
|
||||
}
|
||||
|
||||
public function testCreateUserFailsForShortPassword(): void
|
||||
@@ -53,11 +53,12 @@ class CreateUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] Success! Created user: MyTestUser', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('MyTestUser');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertNotNull($user);
|
||||
}
|
||||
|
||||
protected function createUser($username, $email, $role, $password): CommandTester
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Command\DeactivateUserCommand;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use App\User\UserService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
@@ -32,7 +33,7 @@ class DeactivateUserCommandTest extends KernelTestCase
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
/** @var UserService $userService */
|
||||
$userService = $container->get(UserService::class);
|
||||
|
||||
$this->application->add(new DeactivateUserCommand($userService));
|
||||
@@ -71,8 +72,10 @@ class DeactivateUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] User "john_user" has been deactivated.', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('john_user');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertFalse($user->isEnabled());
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Command\DemoteUserCommand;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use App\User\UserService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
@@ -34,6 +35,7 @@ class DemoteUserCommandTest extends KernelTestCase
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
/** @var UserService $userService */
|
||||
$userService = $container->get(UserService::class);
|
||||
|
||||
$this->application->add(new DemoteUserCommand($userService));
|
||||
@@ -80,8 +82,10 @@ class DemoteUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] Role "ROLE_TEAMLEAD" has been removed from user "tony_teamlead".', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('tony_teamlead');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertFalse($user->hasTeamleadRole());
|
||||
@@ -95,8 +99,10 @@ class DemoteUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] Super administrator role has been removed from the user "susan_super".', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('susan_super');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertFalse($user->isSuperAdmin());
|
||||
|
||||
@@ -45,6 +45,9 @@ class ExportCreateCommandTest extends KernelTestCase
|
||||
|
||||
if (is_dir($path)) {
|
||||
$files = glob($path . '*');
|
||||
if ($files === false) {
|
||||
return;
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
@@ -71,12 +74,12 @@ class ExportCreateCommandTest extends KernelTestCase
|
||||
$container = self::getContainer();
|
||||
|
||||
$application->add(new ExportCreateCommand(
|
||||
$container->get(ServiceExport::class),
|
||||
$container->get(CustomerRepository::class),
|
||||
$container->get(ProjectRepository::class),
|
||||
$container->get(TeamRepository::class),
|
||||
$container->get(UserRepository::class),
|
||||
$container->get(TranslatorInterface::class),
|
||||
$container->get(ServiceExport::class), // @phpstan-ignore argument.type
|
||||
$container->get(CustomerRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(ProjectRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(TeamRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(UserRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(TranslatorInterface::class), // @phpstan-ignore argument.type
|
||||
$mailer ?? $container->get(KimaiMailer::class),
|
||||
));
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Tests\Command;
|
||||
|
||||
use App\Command\InstallCommand;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
@@ -27,9 +28,11 @@ class InstallCommandTest extends KernelTestCase
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
|
||||
$this->application->add(new InstallCommand(
|
||||
$container->get('doctrine')->getConnection()
|
||||
$doctrine->getConnection() // @phpstan-ignore argument.type
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ class InvoiceCreateCommandTest extends KernelTestCase
|
||||
|
||||
if (is_dir($path)) {
|
||||
$files = glob($path . '*');
|
||||
if ($files === false) {
|
||||
return;
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
@@ -64,12 +67,12 @@ class InvoiceCreateCommandTest extends KernelTestCase
|
||||
$container = self::getContainer();
|
||||
|
||||
$this->application->add(new InvoiceCreateCommand(
|
||||
$container->get(ServiceInvoice::class),
|
||||
$container->get(CustomerRepository::class),
|
||||
$container->get(ProjectRepository::class),
|
||||
$container->get(InvoiceTemplateRepository::class),
|
||||
$container->get(UserRepository::class),
|
||||
$container->get('event_dispatcher')
|
||||
$container->get(ServiceInvoice::class), // @phpstan-ignore argument.type
|
||||
$container->get(CustomerRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(ProjectRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(InvoiceTemplateRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get(UserRepository::class), // @phpstan-ignore argument.type
|
||||
$container->get('event_dispatcher') // @phpstan-ignore argument.type
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Command\PromoteUserCommand;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use App\User\UserService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
@@ -35,6 +36,7 @@ class PromoteUserCommandTest extends KernelTestCase
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
$userService = $container->get(UserService::class);
|
||||
$this->assertInstanceOf(UserService::class, $userService);
|
||||
|
||||
$this->application->add(new PromoteUserCommand($userService));
|
||||
}
|
||||
@@ -80,8 +82,10 @@ class PromoteUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] Role "ROLE_TEAMLEAD" has been added to user "john_user".', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('john_user');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertTrue($user->hasTeamleadRole());
|
||||
@@ -95,8 +99,10 @@ class PromoteUserCommandTest extends KernelTestCase
|
||||
$this->assertStringContainsString('[OK] User "john_user" has been promoted as a super administrator.', $output);
|
||||
|
||||
$container = self::$kernel->getContainer();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $container->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = $container->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier('john_user');
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
self::assertTrue($user->isSuperAdmin());
|
||||
|
||||
@@ -42,7 +42,7 @@ class VersionCommandTest extends KernelTestCase
|
||||
$this->assertEquals($result . PHP_EOL, $output);
|
||||
}
|
||||
|
||||
public function getTestData(): array // @phpstan-ignore-line
|
||||
public function getTestData(): array // @phpstan-ignore missingType.iterableValue
|
||||
{
|
||||
return [
|
||||
[[], 'Kimai ' . Constants::VERSION . ' by Kevin Papst.'],
|
||||
|
||||
@@ -20,6 +20,7 @@ use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use App\Tests\Mocks\ActivityTestMetaFieldSubscriberMock;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\DomCrawler\Field\ChoiceFormField;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
@@ -203,7 +204,6 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
]);
|
||||
|
||||
$location = $this->assertIsModalRedirect($client, '/details');
|
||||
self::assertNotNull($location);
|
||||
$this->requestPure($client, $location);
|
||||
|
||||
$this->assertDetailsPage($client);
|
||||
@@ -221,7 +221,9 @@ class ActivityControllerTest extends ControllerBaseTest
|
||||
public function testCreateActionShowsMetaFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock());
|
||||
$eventDispatcher = self::getContainer()->get('event_dispatcher');
|
||||
static::assertInstanceOf(EventDispatcher::class, $eventDispatcher);
|
||||
$eventDispatcher->addSubscriber(new ActivityTestMetaFieldSubscriberMock());
|
||||
$this->assertAccessIsGranted($client, '/admin/activity/create');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use OneLogin\Saml2\Auth;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Security\Http\SecurityRequestAttributes;
|
||||
@@ -105,7 +104,6 @@ class SamlControllerTest extends TestCase
|
||||
$sut = new SamlController($factory, $this->getSamlConfiguration());
|
||||
$result = $sut->metadataAction();
|
||||
|
||||
self::assertInstanceOf(Response::class, $result);
|
||||
self::assertEquals('xml', $result->headers->get('Content-Type'));
|
||||
|
||||
$expected = new \DOMDocument();
|
||||
|
||||
@@ -16,6 +16,7 @@ use App\Entity\User;
|
||||
use App\Form\Type\DateRangeType;
|
||||
use App\Repository\UserRepository;
|
||||
use App\Tests\KernelTestTrait;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\DomCrawler\Crawler;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
@@ -28,6 +29,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
use Symfony\Component\HttpFoundation\Test\Constraint as ResponseConstraint;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
use Symfony\Component\Security\Csrf\CsrfToken;
|
||||
use Symfony\Component\Security\Csrf\CsrfTokenManager;
|
||||
|
||||
/**
|
||||
* ControllerBaseTest adds some useful functions for writing integration tests.
|
||||
@@ -80,8 +82,10 @@ abstract class ControllerBaseTest extends WebTestCase
|
||||
|
||||
protected function loadUserFromDatabase(string $username): User
|
||||
{
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = self::getContainer()->get('doctrine');
|
||||
/** @var UserRepository $userRepository */
|
||||
$userRepository = self::getContainer()->get('doctrine')->getRepository(User::class);
|
||||
$userRepository = $doctrine->getRepository(User::class);
|
||||
$user = $userRepository->loadUserByIdentifier($username);
|
||||
self::assertInstanceOf(User::class, $user);
|
||||
|
||||
@@ -331,10 +335,8 @@ abstract class ControllerBaseTest extends WebTestCase
|
||||
|
||||
foreach ($fieldNames as $name) {
|
||||
$field = $submittedForm->filter($name);
|
||||
self::assertNotNull($field, 'Could not find form field: ' . $name);
|
||||
self::assertGreaterThan(0, $field->count(), 'Could not find form field: ' . $name);
|
||||
$list = $field->nextAll();
|
||||
self::assertNotNull($list, 'Form field has no validation message: ' . $name);
|
||||
|
||||
$validation = $list->filter('li.text-danger');
|
||||
if (\count($validation) < 1) {
|
||||
// decorated form fields with icon have a different html structure
|
||||
@@ -488,8 +490,12 @@ abstract class ControllerBaseTest extends WebTestCase
|
||||
{
|
||||
$request = new Request();
|
||||
$request->setSession(new Session(new MockArraySessionStorage()));
|
||||
self::getContainer()->get(RequestStack::class)->push($request);
|
||||
/** @var RequestStack $stack */
|
||||
$stack = self::getContainer()->get(RequestStack::class);
|
||||
$stack->push($request);
|
||||
/** @var CsrfTokenManager $tokenManager */
|
||||
$tokenManager = self::getContainer()->get('security.csrf.token_manager');
|
||||
|
||||
return self::getContainer()->get('security.csrf.token_manager')->getToken($name);
|
||||
return $tokenManager->getToken($name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use App\Tests\Mocks\CustomerTestMetaFieldSubscriberMock;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\DomCrawler\Field\ChoiceFormField;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
@@ -335,7 +336,9 @@ class CustomerControllerTest extends ControllerBaseTest
|
||||
public function testCreateActionShowsMetaFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = self::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new CustomerTestMetaFieldSubscriberMock());
|
||||
$this->assertAccessIsGranted($client, '/admin/customer/create');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ class InvoiceControllerTest extends ControllerBaseTest
|
||||
|
||||
if (is_dir($path)) {
|
||||
$files = glob($path . '*');
|
||||
if ($files === false) {
|
||||
return;
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use App\Tests\Mocks\ProjectTestMetaFieldSubscriberMock;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\DomCrawler\Field\ChoiceFormField;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
@@ -406,7 +407,9 @@ class ProjectControllerTest extends ControllerBaseTest
|
||||
public function testCreateActionShowsMetaFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = self::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new ProjectTestMetaFieldSubscriberMock());
|
||||
$this->assertAccessIsGranted($client, '/admin/project/create');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
|
||||
$this->assertHasValidationError($client, '/register/', 'form[name=user_registration_form]', $formData, $validationFields);
|
||||
}
|
||||
|
||||
public function getValidationTestData(): array // @phpstan-ignore-line
|
||||
public function getValidationTestData(): array // @phpstan-ignore missingType.iterableValue
|
||||
{
|
||||
return [
|
||||
[
|
||||
|
||||
@@ -29,7 +29,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
||||
|
||||
private function getSystemConfiguration(): SystemConfiguration
|
||||
{
|
||||
return static::getContainer()->get(SystemConfiguration::class);
|
||||
return static::getContainer()->get(SystemConfiguration::class); // @phpstan-ignore return.type
|
||||
}
|
||||
|
||||
public function testIndexAction(): void
|
||||
@@ -72,7 +72,10 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
||||
$this->assertEquals('POST', $form->getMethod());
|
||||
}
|
||||
|
||||
public function getTestDataForms()
|
||||
/**
|
||||
* @return array<array<string>>
|
||||
*/
|
||||
public function getTestDataForms(): array
|
||||
{
|
||||
return [
|
||||
['form[name=system_configuration_form_timesheet]', $this->createUrl('/admin/system-config/update/timesheet')],
|
||||
|
||||
@@ -20,6 +20,7 @@ use App\Tests\DataFixtures\TagFixtures;
|
||||
use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use App\Tests\Mocks\TimesheetTestMetaFieldSubscriberMock;
|
||||
use App\Timesheet\DateTimeFactory;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
@@ -274,7 +275,9 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
public function testCreateActionShowsMetaFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser();
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new TimesheetTestMetaFieldSubscriberMock());
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = self::getContainer()->get('event_dispatcher');
|
||||
$dispatcher->addSubscriber(new TimesheetTestMetaFieldSubscriberMock());
|
||||
$this->request($client, '/timesheet/create');
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
@@ -291,8 +294,8 @@ class TimesheetControllerTest extends ControllerBaseTest
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$form = $client->getCrawler()->filter('form[name=timesheet_edit_form]')->form();
|
||||
$this->assertFalse($form->has('hourlyRate'));
|
||||
$this->assertFalse($form->has('fixedRate'));
|
||||
$this->assertFalse($form->has('timesheet_edit_form[hourlyRate]'));
|
||||
$this->assertFalse($form->has('timesheet_edit_form[fixedRate]'));
|
||||
}
|
||||
|
||||
public function getTrackingModeTestData(): array
|
||||
|
||||
@@ -125,11 +125,7 @@ class CustomerServiceTest extends TestCase
|
||||
{
|
||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
|
||||
if ($event instanceof CustomerMetaDefinitionEvent) {
|
||||
self::assertInstanceOf(Customer::class, $event->getEntity());
|
||||
} elseif ($event instanceof CustomerCreateEvent) {
|
||||
self::assertInstanceOf(Customer::class, $event->getCustomer());
|
||||
} else {
|
||||
if (!$event instanceof CustomerMetaDefinitionEvent && !$event instanceof CustomerCreateEvent) {
|
||||
$this->fail('Invalid event received');
|
||||
}
|
||||
|
||||
@@ -140,7 +136,6 @@ class CustomerServiceTest extends TestCase
|
||||
|
||||
$customer = $sut->createNewCustomer('');
|
||||
|
||||
self::assertInstanceOf(Customer::class, $customer);
|
||||
self::assertEquals('Europe/Vienna', $customer->getTimezone());
|
||||
self::assertEquals('IN', $customer->getCountry());
|
||||
self::assertEquals('RUB', $customer->getCurrency());
|
||||
@@ -150,11 +145,7 @@ class CustomerServiceTest extends TestCase
|
||||
{
|
||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
|
||||
if ($event instanceof CustomerCreatePreEvent) {
|
||||
self::assertInstanceOf(Customer::class, $event->getCustomer());
|
||||
} elseif ($event instanceof CustomerCreatePostEvent) {
|
||||
self::assertInstanceOf(Customer::class, $event->getCustomer());
|
||||
} else {
|
||||
if (!$event instanceof CustomerCreatePreEvent && !$event instanceof CustomerCreatePostEvent) {
|
||||
$this->fail('Invalid event received');
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +185,12 @@ class AppExtensionTest extends TestCase
|
||||
|
||||
$config = $container->getParameter('kimai.config');
|
||||
|
||||
$this->assertIsArray($config);
|
||||
$this->assertArrayHasKey('ldap.user.baseDn', $config);
|
||||
$this->assertArrayHasKey('ldap.user.filter', $config);
|
||||
$this->assertArrayHasKey('ldap.user.usernameAttribute', $config);
|
||||
$this->assertArrayHasKey('ldap.connection.baseDn', $config);
|
||||
$this->assertArrayHasKey('ldap.connection.accountFilterFormat', $config);
|
||||
$this->assertEquals('123123123', $config['ldap.user.baseDn']);
|
||||
$this->assertEquals('(..........)', $config['ldap.user.filter']);
|
||||
$this->assertEquals('xxx', $config['ldap.user.usernameAttribute']);
|
||||
@@ -209,6 +215,7 @@ class AppExtensionTest extends TestCase
|
||||
|
||||
$config = $container->getParameter('kimai.config');
|
||||
|
||||
$this->assertIsArray($config);
|
||||
$this->assertEquals('123123123', $config['ldap.user.baseDn']);
|
||||
$this->assertEquals('xxx', $config['ldap.user.usernameAttribute']);
|
||||
$this->assertEquals('123123123', $config['ldap.connection.baseDn']);
|
||||
@@ -234,6 +241,7 @@ class AppExtensionTest extends TestCase
|
||||
$this->extension->load($minConfig, $container = $this->getContainer());
|
||||
|
||||
$config = $container->getParameter('kimai.config');
|
||||
$this->assertIsArray($config);
|
||||
|
||||
$this->assertEquals('123123123', $config['ldap.user.baseDn']);
|
||||
$this->assertEquals('zzzz', $config['ldap.user.usernameAttribute']);
|
||||
|
||||
@@ -25,7 +25,6 @@ class UTCDateTimeImmutableTypeTest extends TestCase
|
||||
public function testGetUtc(): void
|
||||
{
|
||||
Type::overrideType(Types::DATETIME_MUTABLE, UTCDateTimeImmutableType::class);
|
||||
/** @var UTCDateTimeImmutableType $type */
|
||||
$type = Type::getType(Types::DATETIME_MUTABLE);
|
||||
|
||||
$this->assertInstanceOf(UTCDateTimeImmutableType::class, $type);
|
||||
|
||||
@@ -25,7 +25,6 @@ class UTCDateTimeTypeTest extends TestCase
|
||||
public function testGetUtc(): void
|
||||
{
|
||||
Type::overrideType(Types::DATETIME_MUTABLE, UTCDateTimeType::class);
|
||||
/** @var UTCDateTimeType $type */
|
||||
$type = Type::getType(Types::DATETIME_MUTABLE);
|
||||
|
||||
$this->assertInstanceOf(UTCDateTimeType::class, $type);
|
||||
|
||||
@@ -22,10 +22,4 @@ class CustomerCommentTest extends AbstractCommentEntityTest
|
||||
{
|
||||
return new CustomerComment(new Customer('foo'));
|
||||
}
|
||||
|
||||
public function testEntitySpecificMethods(): void
|
||||
{
|
||||
$sut = $this->getEntity();
|
||||
self::assertNotNull($sut->getCustomer());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,4 @@ class ProjectCommentTest extends AbstractCommentEntityTest
|
||||
{
|
||||
return new ProjectComment(new Project());
|
||||
}
|
||||
|
||||
public function testEntitySpecificMethods(): void
|
||||
{
|
||||
$sut = $this->getEntity();
|
||||
self::assertNotNull($sut->getProject());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace App\Tests\Entity;
|
||||
use App\Entity\UserPreference;
|
||||
use App\Form\Type\YesNoType;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
|
||||
/**
|
||||
@@ -47,8 +46,7 @@ class UserPreferenceTest extends TestCase
|
||||
self::assertSame(1, $sut->getValue());
|
||||
$sut->setType(YesNoType::class);
|
||||
self::assertTrue($sut->getValue());
|
||||
$sut->setValue('0');
|
||||
$sut->setType(CheckboxType::class);
|
||||
$sut->setValue('');
|
||||
self::assertFalse($sut->getValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -26,16 +26,16 @@ class ConfigureMainMenuEventTest extends TestCase
|
||||
{
|
||||
$sut = new ConfigureMainMenuEvent();
|
||||
|
||||
self::assertNotNull($sut->getAppsMenu());
|
||||
self::assertEquals('apps', $sut->getAppsMenu()->getIdentifier());
|
||||
}
|
||||
|
||||
public function testGetterAndSetter(): void
|
||||
{
|
||||
$sut = new ConfigureMainMenuEvent();
|
||||
|
||||
self::assertNotNull($sut->getMenu());
|
||||
self::assertNotNull($sut->getAdminMenu());
|
||||
self::assertNotNull($sut->getSystemMenu());
|
||||
self::assertEquals('main', $sut->getMenu()->getIdentifier());
|
||||
self::assertEquals('admin', $sut->getAdminMenu()->getIdentifier());
|
||||
self::assertEquals('system', $sut->getSystemMenu()->getIdentifier());
|
||||
|
||||
self::assertNull($sut->getTimesheetMenu());
|
||||
self::assertNull($sut->getInvoiceMenu());
|
||||
@@ -62,7 +62,7 @@ class ConfigureMainMenuEventTest extends TestCase
|
||||
self::assertNotNull($sut->getReportingMenu());
|
||||
self::assertSame($reporting, $sut->getReportingMenu());
|
||||
|
||||
self::assertSame($reporting, $sut->findById('reporting'));
|
||||
self::assertSame($reporting, $sut->findById('reporting')); // @phpstan-ignore argument.unresolvableType
|
||||
self::assertNotNull($sut->findById('foo'));
|
||||
self::assertNotNull($sut->findById('bar'));
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ class PageActionsEventTest extends TestCase
|
||||
'columns' => ['modal' => '#foo2', 'title' => 'modal.columns.title'],
|
||||
'create' => ['url' => 'foo5', 'class' => 'modal-ajax-form', 'title' => 'create', 'accesskey' => 'a'],
|
||||
'download' => ['url' => 'foo7', 'class' => 'toolbar-action', 'title' => 'export'],
|
||||
'edit' => ['url' => 'trölölö', 'class' => 'modal-ajax-form', 'translation_domain' => 'actions', 'title' => 'edit'],
|
||||
'trash' => ['url' => 'foo3', 'class' => 'modal-ajax-form text-red', 'translation_domain' => 'actions', 'title' => 'trash'],
|
||||
'edit' => ['url' => 'trölölö', 'class' => 'modal-ajax-form', 'title' => 'edit'],
|
||||
'trash' => ['url' => 'foo3', 'class' => 'modal-ajax-form text-red', 'title' => 'trash'],
|
||||
];
|
||||
$this->assertEquals(\count($expected), $sut->countActions());
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use App\Project\ProjectStatisticService;
|
||||
use Symfony\Bridge\Twig\AppVariable;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Twig\Environment;
|
||||
@@ -62,6 +63,7 @@ class HtmlRendererTest extends AbstractRendererTest
|
||||
$app = $twig->getGlobals()['app'];
|
||||
$twig->addGlobal('app', $app);
|
||||
$app->setTokenStorage($tokenStorage);
|
||||
/** @var RequestStack $stack */
|
||||
$stack = self::getContainer()->get('request_stack');
|
||||
$request = new Request();
|
||||
$request->setLocale('en');
|
||||
|
||||
@@ -22,7 +22,7 @@ class DemoFull
|
||||
#[Exporter\Expose(name: 'fake-name', label: 'Protected-Property', type: 'boolean')]
|
||||
protected bool $protectedProperty = false;
|
||||
#[Exporter\Expose(label: 'Private-Property', type: 'integer', translationDomain: 'test')]
|
||||
private int $privateProperty = 123; // @phpstan-ignore-line
|
||||
private int $privateProperty = 123; // @phpstan-ignore property.onlyWritten
|
||||
|
||||
#[Exporter\Expose(label: 'Public-Method')]
|
||||
public function publicMethod(): string
|
||||
@@ -47,7 +47,7 @@ class DemoFull
|
||||
return 12345;
|
||||
}
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
// @phpstan-ignore method.unused
|
||||
#[Exporter\Expose(name: 'fake-method', label: 'Private-Method', type: 'boolean', translationDomain: 'bar')]
|
||||
private function privateMethod(): bool
|
||||
{
|
||||
|
||||
@@ -14,5 +14,5 @@ use App\Export\Annotation as Exporter;
|
||||
class ExpressionOnProperty
|
||||
{
|
||||
#[Exporter\Expose(name: 'accessor', label: 'accessor', exp: 'object.foo')]
|
||||
private $foo; // @phpstan-ignore-line
|
||||
private $foo; // @phpstan-ignore missingType.property, property.unused
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class AnnotationExtractorTest extends TestCase
|
||||
$this->expectException(ExtractorException::class);
|
||||
$this->expectExceptionMessage('AnnotationExtractor needs a non-empty class name for work');
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->extract(new \stdClass());
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class MetaFieldExtractorTest extends TestCase
|
||||
$this->expectException(ExtractorException::class);
|
||||
$this->expectExceptionMessage('MetaFieldExtractor needs a MetaDisplayEventInterface instance for work');
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->extract(new \stdClass());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class UserPreferenceExtractorTest extends TestCase
|
||||
$this->expectException(ExtractorException::class);
|
||||
$this->expectExceptionMessage('UserPreferenceExtractor needs a UserPreferenceDisplayEvent instance for work');
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->extract(new \stdClass());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,18 @@ class SpreadsheetExporterTest extends TestCase
|
||||
$sut->registerCellFormatter('foo', new class() implements CellFormatterInterface {
|
||||
public function setFormattedValue(Worksheet $sheet, int $column, int $row, $value): void
|
||||
{
|
||||
if (!\is_scalar($value)) {
|
||||
throw new \InvalidArgumentException('Only scalar values are supported');
|
||||
}
|
||||
$sheet->setCellValue([$column, $row], '##' . $value . '##');
|
||||
}
|
||||
});
|
||||
$sut->registerCellFormatter('bar', new class() implements CellFormatterInterface {
|
||||
public function setFormattedValue(Worksheet $sheet, int $column, int $row, $value): void
|
||||
{
|
||||
if (!\is_scalar($value)) {
|
||||
throw new \InvalidArgumentException('Only scalar values are supported');
|
||||
}
|
||||
$sheet->setCellValue([$column, $row], '~' . $value . '~');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ class TimesheetExportRepositoryTest extends TestCase
|
||||
|
||||
$sut->setExported([new Timesheet(), null, new \stdClass(), new Timesheet(), new Activity()]);
|
||||
// test else for empty array
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->setExported([new Customer('foo'), new Project()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ class SearchTermTransformerTest extends TestCase
|
||||
{
|
||||
$sut = new SearchTermTransformer();
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
self::assertEquals('', $sut->transform(''));
|
||||
self::assertEquals('', $sut->transform(null));
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
self::assertEquals('', $sut->transform(new \stdClass()));
|
||||
|
||||
self::assertEquals(
|
||||
|
||||
@@ -34,9 +34,9 @@ class TagArrayToStringTransformerTest extends TestCase
|
||||
|
||||
$this->assertEquals('', $sut->transform([]));
|
||||
$this->assertEquals('', $sut->transform(null));
|
||||
$this->assertEquals('', $sut->transform(new \stdClass())); // @phpstan-ignore-line
|
||||
$this->assertEquals('', $sut->transform(new \stdClass())); // @phpstan-ignore argument.type
|
||||
|
||||
$actual = $sut->transform($results); // @phpstan-ignore-line
|
||||
$actual = $sut->transform($results); // @phpstan-ignore argument.type
|
||||
|
||||
$this->assertEquals('foo,test,bar', $actual);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class TagArrayToStringTransformerTest extends TestCase
|
||||
$repository = $this->getMockBuilder(TagRepository::class)->disableOriginalConstructor()->getMock();
|
||||
|
||||
$sut = new TagArrayToStringTransformer($repository, true);
|
||||
$sut->transform($results); // @phpstan-ignore-line
|
||||
$sut->transform($results); // @phpstan-ignore argument.type
|
||||
}
|
||||
|
||||
public function testReverseTransform(): void
|
||||
|
||||
@@ -58,6 +58,9 @@ class DebugRendererTest extends TestCase
|
||||
$response = $sut->render($document, $model);
|
||||
$data = json_decode($response->getContent(), true);
|
||||
|
||||
$this->assertIsArray($data);
|
||||
$this->assertIsArray($data['model']);
|
||||
|
||||
$this->assertModelStructure($data['model'], \count($model->getQuery()->getProjects()), \count($model->getQuery()->getActivities()));
|
||||
$rows = $data['entries'];
|
||||
$this->assertEquals($expectedRows, \count($rows));
|
||||
|
||||
@@ -102,6 +102,7 @@ class PdfRendererTest extends KernelTestCase
|
||||
$kernel = self::bootKernel();
|
||||
/** @var Environment $twig */
|
||||
$twig = self::getContainer()->get('twig');
|
||||
/** @var RequestStack $stack */
|
||||
$stack = self::getContainer()->get('request_stack');
|
||||
/** @var string $cacheDir */
|
||||
$cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
|
||||
|
||||
@@ -81,10 +81,6 @@ class ServiceInvoiceTest extends TestCase
|
||||
|
||||
$actual = $sut->getDocuments();
|
||||
$this->assertNotEmpty($actual);
|
||||
foreach ($actual as $document) {
|
||||
$this->assertInstanceOf(InvoiceDocument::class, $document);
|
||||
}
|
||||
|
||||
$actual = $sut->getDocumentByName('default');
|
||||
$this->assertInstanceOf(InvoiceDocument::class, $actual);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,6 @@ class KimaiMailerTest extends TestCase
|
||||
|
||||
$mailer->send($message);
|
||||
|
||||
self::assertEquals([new Address('zippel@example.com')], $message->getFrom());
|
||||
self::assertEquals([new Address('zippel@example.com', 'Kimai')], $message->getFrom());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Saml\SamlAuthFactory;
|
||||
use App\Tests\Configuration\TestConfigLoader;
|
||||
use App\Tests\Mocks\AbstractMockFactory;
|
||||
use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
@@ -81,7 +82,8 @@ class SamlAuthFactoryFactory extends AbstractMockFactory
|
||||
|
||||
$mock = $this->getMockBuilder(Request::class)->getMock();
|
||||
$mock->method('isFromTrustedProxy')->willReturn($fromTrustedProxy);
|
||||
/** @var Request $request */
|
||||
|
||||
/** @var Request&MockObject $request */
|
||||
$request = $mock;
|
||||
|
||||
$requestStack = new RequestStack();
|
||||
|
||||
@@ -34,6 +34,7 @@ abstract class AbstractTimesheetCountedStatisticTest extends TestCase
|
||||
self::assertSame(0, $sut->getCounterExported());
|
||||
|
||||
$json = $sut->jsonSerialize();
|
||||
$this->assertIsArray($json);
|
||||
|
||||
$expected = [
|
||||
'duration' => 0,
|
||||
@@ -121,6 +122,7 @@ abstract class AbstractTimesheetCountedStatisticTest extends TestCase
|
||||
$sut->setInternalRateExported(27.15);
|
||||
|
||||
$json = $sut->jsonSerialize();
|
||||
$this->assertIsArray($json);
|
||||
foreach (['duration', 'duration_billable', 'duration_exported', 'rate', 'rate_billable', 'rate_billable_exported', 'rate_exported', 'rate_internal', 'amount', 'amount_billable', 'amount_exported'] as $key) {
|
||||
self::assertArrayHasKey($key, $json);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace App\Tests\Plugin;
|
||||
use App\Plugin\Plugin;
|
||||
use App\Plugin\PluginInterface;
|
||||
use App\Plugin\PluginManager;
|
||||
use App\Plugin\PluginMetadata;
|
||||
use App\Tests\Plugin\Fixtures\TestPlugin\TestPlugin;
|
||||
use App\Tests\Plugin\Fixtures\TestPlugin2\TestPlugin2;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -61,7 +60,6 @@ class PluginManagerTest extends TestCase
|
||||
$this->assertInstanceOf(Plugin::class, $test);
|
||||
$this->assertEquals('TestPlugin', $test->getId());
|
||||
$this->assertEquals('TestPlugin from composer.json', $test->getName());
|
||||
$this->assertInstanceOf(PluginMetadata::class, $test->getMetadata());
|
||||
|
||||
$meta = $test->getMetadata();
|
||||
$this->assertEquals(10000, $meta->getKimaiVersion());
|
||||
|
||||
@@ -115,11 +115,7 @@ class ProjectServiceTest extends TestCase
|
||||
{
|
||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
|
||||
if ($event instanceof ProjectMetaDefinitionEvent) {
|
||||
self::assertInstanceOf(Project::class, $event->getEntity());
|
||||
} elseif ($event instanceof ProjectCreateEvent) {
|
||||
self::assertInstanceOf(Project::class, $event->getProject());
|
||||
} else {
|
||||
if (!$event instanceof ProjectMetaDefinitionEvent && !$event instanceof ProjectCreateEvent) {
|
||||
$this->fail('Invalid event received');
|
||||
}
|
||||
|
||||
@@ -138,11 +134,7 @@ class ProjectServiceTest extends TestCase
|
||||
{
|
||||
$dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
|
||||
if ($event instanceof ProjectCreatePreEvent) {
|
||||
self::assertInstanceOf(Project::class, $event->getProject());
|
||||
} elseif ($event instanceof ProjectCreatePostEvent) {
|
||||
self::assertInstanceOf(Project::class, $event->getProject());
|
||||
} else {
|
||||
if (!$event instanceof ProjectCreatePreEvent && !$event instanceof ProjectCreatePostEvent) {
|
||||
$this->fail('Invalid event received');
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Tests\KernelTestTrait;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
@@ -21,35 +22,24 @@ abstract class AbstractRepositoryTest extends KernelTestCase
|
||||
{
|
||||
use KernelTestTrait;
|
||||
|
||||
/**
|
||||
* @var ObjectManager|null
|
||||
*/
|
||||
private $entityManager;
|
||||
private ?ObjectManager $entityManager = null;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
|
||||
$this->entityManager = $kernel->getContainer()
|
||||
->get('doctrine')
|
||||
->getManager();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $kernel->getContainer()->get('doctrine');
|
||||
|
||||
$this->entityManager = $doctrine->getManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectManager
|
||||
*/
|
||||
protected function getEntityManager()
|
||||
protected function getEntityManager(): ObjectManager
|
||||
{
|
||||
return $this->entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Model\InvoiceDocument;
|
||||
use App\Repository\InvoiceDocumentRepository;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -78,7 +77,7 @@ class InvoiceDocumentRepositoryTest extends TestCase
|
||||
foreach (self::$testDocuments as $document) {
|
||||
$all[] = substr($document, 0, strpos($document, '.'));
|
||||
}
|
||||
$all = array_unique(array_values($all));
|
||||
$all = array_unique($all);
|
||||
self::assertCount(\count($all), $sut->findAll());
|
||||
|
||||
self::assertEquals($path, $sut->getUploadDirectory());
|
||||
@@ -98,7 +97,6 @@ class InvoiceDocumentRepositoryTest extends TestCase
|
||||
$filename = substr($filename, 0, strpos($filename, '.'));
|
||||
$actual = $sut->findByName($filename);
|
||||
$this->assertNotNull($actual);
|
||||
$this->assertInstanceOf(InvoiceDocument::class, $actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Repository\Query\ActivityQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\ActivityQuery
|
||||
@@ -23,11 +22,8 @@ class ActivityQueryTest extends BaseQueryTest
|
||||
$sut = new ActivityQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
|
||||
$this->assertCustomer($sut);
|
||||
$this->assertProject($sut);
|
||||
|
||||
$this->assertResetByFormError(new ActivityQuery(), 'name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Repository\Query\CustomerQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\CustomerQuery
|
||||
@@ -22,8 +21,6 @@ class CustomerQueryTest extends BaseQueryTest
|
||||
$sut = new CustomerQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
|
||||
$this->assertResetByFormError(new CustomerQuery(), 'name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Repository\Query\ProjectQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\ProjectQuery
|
||||
@@ -23,10 +22,7 @@ class ProjectQueryTest extends BaseQueryTest
|
||||
$sut = new ProjectQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
|
||||
$this->assertCustomer($sut);
|
||||
|
||||
$this->assertResetByFormError(new ProjectQuery(), 'name');
|
||||
|
||||
self::assertNull($sut->getProjectStart());
|
||||
|
||||
@@ -21,8 +21,6 @@ class TagQueryTest extends BaseQueryTest
|
||||
$sut = new TagQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(TagQuery::class, $sut);
|
||||
|
||||
$this->assertResetByFormError(new TagQuery(), 'name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,7 @@ class TeamQueryTest extends BaseQueryTest
|
||||
$sut = new TeamQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(TeamQuery::class, $sut);
|
||||
|
||||
$this->assertUsers($sut);
|
||||
|
||||
$this->assertResetByFormError(new TeamQuery(), 'name');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\UserQuery
|
||||
@@ -22,10 +21,8 @@ class UserQueryTest extends BaseQueryTest
|
||||
{
|
||||
$sut = new UserQuery();
|
||||
$this->assertBaseQuery($sut, 'username');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
$this->assertRole($sut);
|
||||
$this->assertSearchTeam($sut);
|
||||
|
||||
$this->assertResetByFormError(new UserQuery(), 'username');
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class TimesheetInvoiceItemRepositoryTest extends TestCase
|
||||
|
||||
$sut->setExported([new Timesheet(), null, new \stdClass(), new Timesheet(), new Activity()]);
|
||||
// test else for empty array
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->setExported([new Customer('foo'), new Project()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class UserCheckerTest extends TestCase
|
||||
} catch (\Exception $ex) {
|
||||
$this->fail('UserChecker should not throw exception in checkPreAuth(), ' . $ex->getMessage());
|
||||
}
|
||||
$this->assertTrue(true);
|
||||
$this->expectNotToPerformAssertions();
|
||||
}
|
||||
|
||||
public function testCheckPostAuthReturnsOnUnknownUserClass(): void
|
||||
@@ -40,7 +40,7 @@ class UserCheckerTest extends TestCase
|
||||
} catch (\Exception $ex) {
|
||||
$this->fail('UserChecker should not throw exception in checkPostAuth(), ' . $ex->getMessage());
|
||||
}
|
||||
$this->assertTrue(true);
|
||||
$this->expectNotToPerformAssertions();
|
||||
}
|
||||
|
||||
public function testDisabledCannotLoginInCheckPreAuth(): void
|
||||
|
||||
@@ -21,13 +21,12 @@ class DefaultModeTest extends AbstractTrackingModeTest
|
||||
public function assertDefaultBegin(Timesheet $timesheet): void
|
||||
{
|
||||
self::assertNotNull($timesheet->getBegin());
|
||||
self::assertInstanceOf(\DateTime::class, $timesheet->getBegin());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DefaultMode
|
||||
*/
|
||||
protected function createSut()
|
||||
protected function createSut(): DefaultMode
|
||||
{
|
||||
return new DefaultMode((new RoundingServiceFactory($this))->create());
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class TranslationsTest extends TestCase
|
||||
public function testForWrongFileExtension(): void
|
||||
{
|
||||
$files = glob(__DIR__ . '/../translations/*.*');
|
||||
$this->assertIsArray($files);
|
||||
foreach ($files as $file) {
|
||||
self::assertStringEndsWith('.xlf', $file);
|
||||
}
|
||||
@@ -27,6 +28,7 @@ class TranslationsTest extends TestCase
|
||||
public function testForEmptyStrings(): void
|
||||
{
|
||||
$files = glob(__DIR__ . '/../translations/*.xlf');
|
||||
$this->assertIsArray($files);
|
||||
foreach ($files as $file) {
|
||||
$xml = simplexml_load_file($file);
|
||||
|
||||
@@ -50,6 +52,7 @@ class TranslationsTest extends TestCase
|
||||
public function testReplacerWereNotTranslated(): void
|
||||
{
|
||||
$englishFiles = glob(__DIR__ . '/../translations/*.en.xlf');
|
||||
$this->assertIsArray($englishFiles);
|
||||
foreach ($englishFiles as $englishFile) {
|
||||
$english = simplexml_load_file($englishFile);
|
||||
$trans = [];
|
||||
@@ -70,6 +73,7 @@ class TranslationsTest extends TestCase
|
||||
|
||||
$expectedCounter = \count($trans);
|
||||
$files = glob(__DIR__ . '/../translations/' . str_replace('.en.xlf', '', basename($englishFile)) . '*.xlf');
|
||||
$this->assertIsArray($files);
|
||||
foreach ($files as $file) {
|
||||
if ($englishFile === $file) {
|
||||
continue;
|
||||
|
||||
@@ -113,9 +113,9 @@ class ExtensionsTest extends TestCase
|
||||
$sut = $this->getSut();
|
||||
$this->assertEquals('DateTime', $sut->getClassName(new \DateTime()));
|
||||
$this->assertEquals('stdClass', $sut->getClassName(new \stdClass()));
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$this->assertNull($sut->getClassName(''));
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$this->assertNull($sut->getClassName(null));
|
||||
$this->assertEquals('App\Entity\User', $sut->getClassName(new User()));
|
||||
}
|
||||
|
||||
@@ -139,7 +139,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, \DateTime|string|null>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getDateShortData(): array
|
||||
{
|
||||
@@ -196,7 +195,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, string|bool>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getDayNameTestData(): array
|
||||
{
|
||||
@@ -219,7 +217,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, string|bool>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMonthNameTestData(): array
|
||||
{
|
||||
@@ -296,7 +293,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, string|null|int|float>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMoneyNoCurrencyData(): array
|
||||
{
|
||||
@@ -331,7 +327,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, null|string|float|int>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMoneyData(): array
|
||||
{
|
||||
@@ -365,7 +360,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, null|int|string|float>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getAmountData(): array
|
||||
{
|
||||
@@ -397,7 +391,6 @@ class LocaleFormatExtensionsTest extends TestCase
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, string|float>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMoneyData62_1(): array
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ use App\Tests\Configuration\TestConfigLoader;
|
||||
use App\Tests\Event\ThemeJavascriptTranslationsEventTest;
|
||||
use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use App\Twig\Runtime\ThemeExtension;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bridge\Twig\AppVariable;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
@@ -72,7 +73,7 @@ class ThemeEventExtensionTest extends TestCase
|
||||
{
|
||||
$mock = $this->getMockBuilder(UsernamePasswordToken::class)->onlyMethods(['getUser'])->disableOriginalConstructor()->getMock();
|
||||
$mock->method('getUser')->willReturn(new User());
|
||||
/** @var UsernamePasswordToken $token */
|
||||
/** @var UsernamePasswordToken&MockObject $token */
|
||||
$token = $mock;
|
||||
|
||||
$tokenStorage = new TokenStorage();
|
||||
|
||||
@@ -68,7 +68,7 @@ class WidgetExtensionTest extends TestCase
|
||||
$this->expectExceptionMessage('Widget must be either a WidgetInterface or a string');
|
||||
|
||||
$sut = $this->getSut();
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->renderWidget($this->getEnvironment(), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class TeamValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
$this->expectException(UnexpectedTypeException::class);
|
||||
|
||||
$this->validator->validate('foo', new NotBlank()); // @phpstan-ignore-line
|
||||
$this->validator->validate('foo', new NotBlank()); // @phpstan-ignore argument.type
|
||||
}
|
||||
|
||||
public function testMissingTeamlead(): void
|
||||
|
||||
@@ -36,19 +36,19 @@ class UserValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
$this->expectException(UnexpectedTypeException::class);
|
||||
|
||||
$this->validator->validate('foo', new NotBlank()); // @phpstan-ignore-line
|
||||
$this->validator->validate('foo', new NotBlank()); // @phpstan-ignore argument.type
|
||||
}
|
||||
|
||||
public function testNullIsValid(): void
|
||||
{
|
||||
$this->validator->validate(null, new User(['message' => 'myMessage'])); // @phpstan-ignore-line
|
||||
$this->validator->validate(null, new User(['message' => 'myMessage'])); // @phpstan-ignore argument.type
|
||||
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
public function testNonUserIsValid(): void
|
||||
{
|
||||
$this->validator->validate(new TestUserEntity(), new User(['message' => 'myMessage'])); // @phpstan-ignore-line
|
||||
$this->validator->validate(new TestUserEntity(), new User(['message' => 'myMessage'])); // @phpstan-ignore argument.type
|
||||
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
@@ -19,22 +19,17 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
|
||||
abstract class AbstractVoterTest extends TestCase
|
||||
{
|
||||
protected function getVoter(string $voterClass): Voter
|
||||
protected function getVoter(string $voterClass): Voter // @phpstan-ignore missingType.generics
|
||||
{
|
||||
$class = new \ReflectionClass($voterClass);
|
||||
/** @var Voter $voter */
|
||||
$voter = $class->newInstance($this->getRolePermissionManager());
|
||||
$voter = $class->newInstance($this->getRolePermissionManager()); // @phpstan-ignore missingType.generics
|
||||
self::assertInstanceOf(Voter::class, $voter);
|
||||
|
||||
return $voter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string|null $role
|
||||
* @return User
|
||||
*/
|
||||
protected function getUser(int $id, ?string $role)
|
||||
protected function getUser(int $id, ?string $role): User
|
||||
{
|
||||
$roles = [];
|
||||
if (!empty($role)) {
|
||||
@@ -55,8 +50,6 @@ abstract class AbstractVoterTest extends TestCase
|
||||
|
||||
/**
|
||||
* @param array<string, array<string>> $permissions
|
||||
* @param bool $overwrite
|
||||
* @return RolePermissionManager
|
||||
*/
|
||||
protected function getRolePermissionManager(array $permissions = [], bool $overwrite = false): RolePermissionManager
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use App\Timesheet\LockdownService;
|
||||
use App\Voter\TimesheetVoter;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
|
||||
/**
|
||||
@@ -27,7 +26,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
*/
|
||||
class TimesheetVoterTest extends AbstractVoterTest
|
||||
{
|
||||
protected function getVoter(string $voterClass): Voter
|
||||
protected function getVoter(string $voterClass): TimesheetVoter
|
||||
{
|
||||
return $this->getLockdownVoter();
|
||||
}
|
||||
@@ -204,7 +203,7 @@ class TimesheetVoterTest extends AbstractVoterTest
|
||||
return $user;
|
||||
}
|
||||
|
||||
protected function getLockdownVoter(?string $lockdownBegin = null, ?string $lockdownEnd = null, ?string $lockdownGrace = null): Voter
|
||||
protected function getLockdownVoter(?string $lockdownBegin = null, ?string $lockdownEnd = null, ?string $lockdownGrace = null): TimesheetVoter
|
||||
{
|
||||
$loader = $this->createMock(ConfigLoaderInterface::class);
|
||||
$config = SystemConfigurationFactory::create($loader, [
|
||||
@@ -217,9 +216,6 @@ class TimesheetVoterTest extends AbstractVoterTest
|
||||
]
|
||||
]);
|
||||
|
||||
$voter = new TimesheetVoter($this->getRolePermissionManager(), new LockdownService($config));
|
||||
self::assertInstanceOf(Voter::class, $voter);
|
||||
|
||||
return $voter;
|
||||
return new TimesheetVoter($this->getRolePermissionManager(), new LockdownService($config));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace App\Tests\Widget\Type;
|
||||
use App\Entity\User;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Widget\Type\DailyWorkingTimeChart;
|
||||
use App\Widget\WidgetInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,6 @@ class DailyWorkingTimeChartTest extends TestCase
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
self::assertInstanceOf(WidgetInterface::class, $sut);
|
||||
self::assertEquals('DailyWorkingTimeChart', $sut->getId());
|
||||
self::assertEquals('stats.yourWorkingHours', $sut->getTitle());
|
||||
$options = $sut->getOptions();
|
||||
|
||||
@@ -15,11 +15,9 @@ class More extends AbstractWidgetType
|
||||
{
|
||||
private mixed $data = null;
|
||||
|
||||
public function setData(mixed $data): self
|
||||
public function setData(mixed $data): void
|
||||
{
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
namespace App\Tests\Widget\Type;
|
||||
|
||||
use App\Widget\Type\AbstractWidgetType;
|
||||
|
||||
/**
|
||||
* @covers \App\Tests\Widget\Type\More
|
||||
*/
|
||||
@@ -36,8 +34,6 @@ class MoreTest extends AbstractWidgetTypeTest
|
||||
{
|
||||
$sut = $this->createSut();
|
||||
|
||||
self::assertInstanceOf(AbstractWidgetType::class, $sut->setData(''));
|
||||
|
||||
$sut->setData('slkudfhalksjdhfkljsahdf');
|
||||
self::assertEquals('slkudfhalksjdhfkljsahdf', $sut->getData());
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class WidgetExceptionTest extends TestCase
|
||||
{
|
||||
public function testConstruct(): void
|
||||
{
|
||||
$ex = new WidgetException();
|
||||
self::assertInstanceOf(\Exception::class, $ex);
|
||||
$ex = new WidgetException('foo');
|
||||
self::assertEquals('foo', $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,24 @@ class WorkingTimeCalculatorDayTest extends TestCase
|
||||
$saturday = $friday->modify('+1 day');
|
||||
$sunday = $saturday->modify('+1 day');
|
||||
|
||||
// verify not nullable
|
||||
$sut = new WorkingTimeCalculatorDay(new User());
|
||||
self::assertFalse($sut->isWorkDay($monday));
|
||||
self::assertFalse($sut->isWorkDay($tuesday));
|
||||
self::assertFalse($sut->isWorkDay($wednesday));
|
||||
self::assertFalse($sut->isWorkDay($thursday));
|
||||
self::assertFalse($sut->isWorkDay($friday));
|
||||
self::assertFalse($sut->isWorkDay($saturday));
|
||||
self::assertFalse($sut->isWorkDay($sunday));
|
||||
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($monday));
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($tuesday));
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($wednesday));
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($thursday));
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($friday));
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($saturday));
|
||||
self::assertEquals(0, $sut->getWorkHoursForDay($sunday));
|
||||
|
||||
$user = new User();
|
||||
$user->setPreferenceValue(WorkingTimeCalculatorDay::WORK_HOURS_MONDAY, 0);
|
||||
$user->setPreferenceValue(WorkingTimeCalculatorDay::WORK_HOURS_TUESDAY, 3600);
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace App\Tests\WorkingTime\Model;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\WorkingTime;
|
||||
use App\WorkingTime\Model\Day;
|
||||
use App\WorkingTime\Model\Month;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -39,7 +38,6 @@ class MonthTest extends TestCase
|
||||
self::assertNull($month->getLockDate());
|
||||
self::assertNull($month->getLockedBy());
|
||||
foreach ($month->getDays() as $day) {
|
||||
self::assertInstanceOf(Day::class, $day);
|
||||
self::assertNull($day->getWorkingTime());
|
||||
|
||||
$duration = rand(0, 28000);
|
||||
|
||||
@@ -60,6 +60,5 @@ class YearPerUserSummaryTest extends TestCase
|
||||
self::assertEquals(371358, $sut->getExpectedTime());
|
||||
self::assertEquals(1, $sut->count());
|
||||
self::assertEquals([$summary], $sut->getSummaries());
|
||||
self::assertInstanceOf(\Traversable::class, $sut->getIterator());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// TODO remove once PARTIAL usage was replaced entirely
|
||||
\Doctrine\Deprecations\Deprecation::ignoreDeprecations('https://github.com/doctrine/orm/issues/8471');
|
||||
|
||||
if (isset($_ENV['BOOTSTRAP_RESET_DATABASE']) && (bool) $_ENV['BOOTSTRAP_RESET_DATABASE'] === true) {
|
||||
echo 'Re-Installing test database ...' . PHP_EOL;
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');
|
||||
|
||||
$env = $_SERVER['APP_ENV'] ?? 'prod';
|
||||
$env = is_string($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : 'prod';
|
||||
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? (in_array($env, ['dev', 'test'])));
|
||||
|
||||
$kernel = new Kernel($env, $debug);
|
||||
$kernel->boot();
|
||||
|
||||
return $kernel->getContainer()->get('doctrine')->getManager(); // @phpstan-ignore-line
|
||||
return $kernel->getContainer()->get('doctrine')->getManager(); // @phpstan-ignore method.notFound
|
||||
|
||||
@@ -15,10 +15,21 @@ parameters:
|
||||
excludePaths:
|
||||
- %rootDir%/../../../tests/Ldap/LdapDriverTest.php
|
||||
inferPrivatePropertyTypeFromConstructor: true
|
||||
treatPhpDocTypesAsCertain: false
|
||||
doctrine:
|
||||
objectManagerLoader: %rootDir%/../../../tests/phpstan-doctrine.php
|
||||
ignoreErrors:
|
||||
- identifier: missingType.iterableValue
|
||||
|
||||
-
|
||||
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with '(.*)' and (.*) will always evaluate to true\\.$#"
|
||||
|
||||
-
|
||||
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with '(.*)' and (.*) will always evaluate to true\\.$#"
|
||||
|
||||
-
|
||||
message: "#^PHPDoc tag @var with type App\\\\(.*) is not subtype of native type PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#"
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\APIControllerBaseTest\\:\\:assertApiException\\(\\) has parameter \\$expectedErrors with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -126,7 +137,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
|
||||
count: 2
|
||||
count: 3
|
||||
path: API/APIControllerBaseTest.php
|
||||
|
||||
-
|
||||
@@ -139,11 +150,6 @@ parameters:
|
||||
count: 4
|
||||
path: API/ActionsControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: API/ActivityControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getId\\(\\) on App\\\\Entity\\\\Activity\\|null\\.$#"
|
||||
count: 2
|
||||
@@ -244,11 +250,6 @@ parameters:
|
||||
count: 1
|
||||
path: API/ApiDocControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: API/CustomerControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getId\\(\\) on App\\\\Entity\\\\Customer\\|null\\.$#"
|
||||
count: 2
|
||||
@@ -294,11 +295,6 @@ parameters:
|
||||
count: 13
|
||||
path: API/CustomerControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: API/ProjectControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getId\\(\\) on App\\\\Entity\\\\Project\\|null\\.$#"
|
||||
count: 2
|
||||
@@ -388,42 +384,11 @@ parameters:
|
||||
message: "#^Parameter \\#5 \\$content of method App\\\\Tests\\\\API\\\\APIControllerBaseTest\\:\\:request\\(\\) expects string\\|null, string\\|false given\\.$#"
|
||||
count: 3
|
||||
path: API/TagControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'activities' on mixed\\.$#"
|
||||
count: 4
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'customers' on mixed\\.$#"
|
||||
count: 4
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'id' on mixed\\.$#"
|
||||
count: 35
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'members' on mixed\\.$#"
|
||||
count: 2
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'projects' on mixed\\.$#"
|
||||
count: 4
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
|
||||
count: 38
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertCount\\(\\) expects Countable\\|iterable, mixed given\\.$#"
|
||||
count: 14
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#5 \\$content of method App\\\\Tests\\\\API\\\\APIControllerBaseTest\\:\\:request\\(\\) expects string\\|null, string\\|false given\\.$#"
|
||||
count: 23
|
||||
@@ -434,36 +399,11 @@ parameters:
|
||||
count: 1
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'description' on mixed\\.$#"
|
||||
count: 3
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'id' on mixed\\.$#"
|
||||
count: 3
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'metaFields' on mixed\\.$#"
|
||||
count: 2
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'tags' on mixed\\.$#"
|
||||
count: 3
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 0 on mixed\\.$#"
|
||||
count: 1
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getDescription\\(\\) on App\\\\Entity\\\\Timesheet\\|null\\.$#"
|
||||
count: 1
|
||||
@@ -494,11 +434,6 @@ parameters:
|
||||
count: 1
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$result of method App\\\\Tests\\\\API\\\\APIControllerBaseTest\\:\\:assertApiResponseTypeStructure\\(\\) expects array, mixed given\\.$#"
|
||||
count: 6
|
||||
path: API/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'enabled' on mixed\\.$#"
|
||||
count: 1
|
||||
@@ -514,41 +449,16 @@ parameters:
|
||||
count: 8
|
||||
path: API/UserControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Command/ActivateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$userService of class App\\\\Command\\\\ActivateUserCommand constructor expects App\\\\User\\\\UserService, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ActivateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$command of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Console\\\\Application\\:\\:add\\(\\) expects Symfony\\\\Component\\\\Console\\\\Command\\\\Command, object given\\.$#"
|
||||
count: 1
|
||||
path: Command/BundleInstallerCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Command/ChangePasswordCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$hashedPassword of method Symfony\\\\Component\\\\PasswordHasher\\\\PasswordHasherInterface\\:\\:verify\\(\\) expects string, string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ChangePasswordCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$userService of class App\\\\Command\\\\ChangePasswordCommand constructor expects App\\\\User\\\\UserService, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ChangePasswordCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Command/CreateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Command\\\\CreateUserCommandTest\\:\\:createUser\\(\\) has parameter \\$email with no type specified\\.$#"
|
||||
count: 1
|
||||
@@ -569,36 +479,6 @@ parameters:
|
||||
count: 1
|
||||
path: Command/CreateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$userService of class App\\\\Command\\\\CreateUserCommand constructor expects App\\\\User\\\\UserService, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/CreateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Command/DeactivateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$userService of class App\\\\Command\\\\DeactivateUserCommand constructor expects App\\\\User\\\\UserService, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/DeactivateUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 2
|
||||
path: Command/DemoteUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$userService of class App\\\\Command\\\\DemoteUserCommand constructor expects App\\\\User\\\\UserService, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/DemoteUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Command\\\\ExportCreateCommandTest\\:\\:assertCommandErrors\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -624,46 +504,6 @@ parameters:
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$serviceExport of class App\\\\Command\\\\ExportCreateCommand constructor expects App\\\\Export\\\\ServiceExport, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$customerRepository of class App\\\\Command\\\\ExportCreateCommand constructor expects App\\\\Repository\\\\CustomerRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$projectRepository of class App\\\\Command\\\\ExportCreateCommand constructor expects App\\\\Repository\\\\ProjectRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$teamRepository of class App\\\\Command\\\\ExportCreateCommand constructor expects App\\\\Repository\\\\TeamRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#5 \\$userRepository of class App\\\\Command\\\\ExportCreateCommand constructor expects App\\\\Repository\\\\UserRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#6 \\$translator of class App\\\\Command\\\\ExportCreateCommand constructor expects Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/ExportCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getConnection\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Command/InstallCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Command\\\\InvoiceCreateCommandTest\\:\\:assertCommandErrors\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -679,36 +519,6 @@ parameters:
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$serviceInvoice of class App\\\\Command\\\\InvoiceCreateCommand constructor expects App\\\\Invoice\\\\ServiceInvoice, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$customerRepository of class App\\\\Command\\\\InvoiceCreateCommand constructor expects App\\\\Repository\\\\CustomerRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$projectRepository of class App\\\\Command\\\\InvoiceCreateCommand constructor expects App\\\\Repository\\\\ProjectRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$invoiceTemplateRepository of class App\\\\Command\\\\InvoiceCreateCommand constructor expects App\\\\Repository\\\\InvoiceTemplateRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#5 \\$userRepository of class App\\\\Command\\\\InvoiceCreateCommand constructor expects App\\\\Repository\\\\UserRepository, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#6 \\$eventDispatcher of class App\\\\Command\\\\InvoiceCreateCommand constructor expects Psr\\\\EventDispatcher\\\\EventDispatcherInterface, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/InvoiceCreateCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Command\\\\PluginCommandTest\\:\\:getCommandTester\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -719,16 +529,6 @@ parameters:
|
||||
count: 1
|
||||
path: Command/PluginCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 2
|
||||
path: Command/PromoteUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$userService of class App\\\\Command\\\\PromoteUserCommand constructor expects App\\\\User\\\\UserService, object\\|null given\\.$#"
|
||||
count: 1
|
||||
path: Command/PromoteUserCommandTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Command\\\\VersionCommandTest\\:\\:getCommandTester\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -789,11 +589,6 @@ parameters:
|
||||
count: 1
|
||||
path: Configuration/SystemConfigurationTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/ActivityControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getId\\(\\) on App\\\\Entity\\\\Activity\\|null\\.$#"
|
||||
count: 4
|
||||
@@ -864,21 +659,6 @@ parameters:
|
||||
count: 4
|
||||
path: Controller/CalendarControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getRepository\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/ControllerBaseTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getToken\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/ControllerBaseTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method push\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/ControllerBaseTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\ControllerBaseTest\\:\\:assertAccessIsGranted\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@@ -934,11 +714,6 @@ parameters:
|
||||
count: 10
|
||||
path: Controller/ControllerBaseTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/CustomerControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getCustomer\\(\\) on App\\\\Entity\\\\Project\\|null\\.$#"
|
||||
count: 2
|
||||
@@ -1004,11 +779,6 @@ parameters:
|
||||
count: 2
|
||||
path: Controller/ExportControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
path: Controller/InvoiceControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$url of method App\\\\Tests\\\\Controller\\\\ControllerBaseTest\\:\\:assertHasValidationError\\(\\) expects string, string\\|null given\\.$#"
|
||||
count: 1
|
||||
@@ -1114,11 +884,6 @@ parameters:
|
||||
count: 6
|
||||
path: Controller/ProfileControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/ProjectControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getId\\(\\) on App\\\\Entity\\\\Activity\\|null\\.$#"
|
||||
count: 1
|
||||
@@ -1294,16 +1059,6 @@ parameters:
|
||||
count: 17
|
||||
path: Controller/Security/SelfRegistrationControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\SystemConfigurationControllerTest\\:\\:getSystemConfiguration\\(\\) should return App\\\\Configuration\\\\SystemConfiguration but returns object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/SystemConfigurationControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\SystemConfigurationControllerTest\\:\\:getTestDataForms\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/SystemConfigurationControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getValue\\(\\) on array\\<array\\<Symfony\\\\Component\\\\DomCrawler\\\\Field\\\\FormField\\>\\|Symfony\\\\Component\\\\DomCrawler\\\\Field\\\\FormField\\>\\|Symfony\\\\Component\\\\DomCrawler\\\\Field\\\\FormField\\.$#"
|
||||
count: 2
|
||||
@@ -1319,11 +1074,6 @@ parameters:
|
||||
count: 2
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method addSubscriber\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Controller/TimesheetControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method modify\\(\\) on DateTime\\|null\\.$#"
|
||||
count: 1
|
||||
@@ -1454,26 +1204,6 @@ parameters:
|
||||
count: 1
|
||||
path: DependencyInjection/AppExtensionTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'ldap\\.connection…' on array\\|bool\\|float\\|int\\|string\\|null\\.$#"
|
||||
count: 6
|
||||
path: DependencyInjection/AppExtensionTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'ldap\\.user\\.baseDn' on array\\|bool\\|float\\|int\\|string\\|null\\.$#"
|
||||
count: 3
|
||||
path: DependencyInjection/AppExtensionTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'ldap\\.user\\.filter' on array\\|bool\\|float\\|int\\|string\\|null\\.$#"
|
||||
count: 3
|
||||
path: DependencyInjection/AppExtensionTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'ldap\\.user…' on array\\|bool\\|float\\|int\\|string\\|null\\.$#"
|
||||
count: 3
|
||||
path: DependencyInjection/AppExtensionTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method load\\(\\) on App\\\\DependencyInjection\\\\AppExtension\\|null\\.$#"
|
||||
count: 7
|
||||
@@ -1819,11 +1549,6 @@ parameters:
|
||||
count: 1
|
||||
path: Export/Renderer/CsvRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method push\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Export/Renderer/HtmlRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$haystack of function substr_count expects string, string\\|false given\\.$#"
|
||||
count: 6
|
||||
@@ -2209,41 +1934,6 @@ parameters:
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRenderer.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'entries' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'invoice\\.first' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'invoice\\.last' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'model' on mixed\\.$#"
|
||||
count: 5
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'query\\.begin_day' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'query\\.begin_month…' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method format\\(\\) on DateTime\\|null\\.$#"
|
||||
count: 2
|
||||
@@ -2329,36 +2019,11 @@ parameters:
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Method class@anonymous/Invoice/Renderer/DebugRendererTest\\.php\\:35\\:\\:hydrate\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Method class@anonymous/Invoice/Renderer/DebugRendererTest\\.php\\:47\\:\\:hydrate\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$model of method App\\\\Tests\\\\Invoice\\\\Renderer\\\\DebugRendererTest\\:\\:assertEntryStructure\\(\\) expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$model of method App\\\\Tests\\\\Invoice\\\\Renderer\\\\DebugRendererTest\\:\\:assertModelStructure\\(\\) expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/DebugRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\Renderer\\\\DocxRendererTest\\:\\:getAbstractRenderer\\(\\) should return App\\\\Invoice\\\\Renderer\\\\AbstractRenderer but returns object\\.$#"
|
||||
count: 1
|
||||
@@ -2404,11 +2069,6 @@ parameters:
|
||||
count: 1
|
||||
path: Invoice/Renderer/OdsRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method push\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Invoice/Renderer/PdfRendererTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\Renderer\\\\PdfRendererTest\\:\\:getAbstractRenderer\\(\\) should return App\\\\Invoice\\\\Renderer\\\\AbstractRenderer but returns object\\.$#"
|
||||
count: 1
|
||||
@@ -2579,71 +2239,6 @@ parameters:
|
||||
count: 1
|
||||
path: Mocks/TrackingModeServiceFactory.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'amount' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'amount'\\|'amount_billable'\\|'amount_exported'\\|'duration'\\|'duration_billable'\\|'duration_billable…'\\|'duration_exported'\\|'rate'\\|'rate_billable'\\|'rate_exported'\\|'rate_internal' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'amount_billable' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'amount_exported' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'duration' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'duration_billable' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'duration_billable…' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'duration_exported' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'rate' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'rate_billable' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'rate_billable…' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'rate_internal' on mixed\\.$#"
|
||||
count: 1
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) expects array\\|ArrayAccess, mixed given\\.$#"
|
||||
count: 2
|
||||
path: Model/AbstractTimesheetCountedStatisticTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'color' on mixed\\.$#"
|
||||
count: 1
|
||||
@@ -2714,11 +2309,6 @@ parameters:
|
||||
count: 2
|
||||
path: Reporting/ProjectDateRange/ProjectDateRangeQueryTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getManager\\(\\) on object\\|null\\.$#"
|
||||
count: 1
|
||||
path: Repository/AbstractRepositoryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Repository\\\\AbstractRepositoryTest\\:\\:getEntityManager\\(\\) should return Doctrine\\\\Persistence\\\\ObjectManager but returns Doctrine\\\\Persistence\\\\ObjectManager\\|null\\.$#"
|
||||
count: 1
|
||||
@@ -3354,11 +2944,6 @@ parameters:
|
||||
count: 1
|
||||
path: Timesheet/UtilTest.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 4
|
||||
path: TranslationsTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access property \\$file on SimpleXMLElement\\|false\\.$#"
|
||||
count: 4
|
||||
|
||||
Reference in New Issue
Block a user