Release 2.0.11 (#3932)
- added "today" as selector in date-range dropdown - added feature to prevent auto-select of dropdowns with only one entry - added hint that no changes were detected in batch update - added negative invoice sums are possible (e.g. for credit notes) - fix project list is expanded after submission - fix invalid date parsing causes 500 - fix: prevent auto-select of activities in export and invoice form (in case only one global activity exists) - fix team assignments for customer and project were not saved (using API now) - fix form fieldset with legend styling (e.g. team project assignment) - fix required meta-field were forced to have a value in batch update - fix tomselect meta-field was not disabled in batch update - fix unset internal rate is shown as 0 - fix one minute rounding problem in duration-only mode with "now" being default time - fix column width and label for duration-only mode - tech debt: cleanup invoice template (remove invoice layout) - tech debt: reorder for simpler comparison with invoice form - possible BC for devs: remove unused methods from form trait - bump composer packages (includes new translations for auth screens)
This commit is contained in:
@@ -12,6 +12,7 @@ namespace App\Tests\API;
|
||||
use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TeamFixtures;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
@@ -30,12 +31,15 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
return $this->importFixture($fixture);
|
||||
}
|
||||
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/api/teams');
|
||||
}
|
||||
|
||||
public function getRoleTestData()
|
||||
/**
|
||||
* @return array<int, array<int, string>>
|
||||
*/
|
||||
public function getRoleTestData(): array
|
||||
{
|
||||
return [
|
||||
[User::ROLE_USER],
|
||||
@@ -46,12 +50,12 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
/**
|
||||
* @dataProvider getRoleTestData
|
||||
*/
|
||||
public function testIsSecureForRole(string $role)
|
||||
public function testIsSecureForRole(string $role): void
|
||||
{
|
||||
$this->assertUrlIsSecuredForRole($role, '/api/teams');
|
||||
}
|
||||
|
||||
public function testGetCollection()
|
||||
public function testGetCollection(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->importTeamFixtures();
|
||||
@@ -64,7 +68,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('TeamCollection', $result[0]);
|
||||
}
|
||||
|
||||
public function testGetEntity()
|
||||
public function testGetEntity(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$teams = $this->importTeamFixtures();
|
||||
@@ -77,18 +81,18 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
}
|
||||
|
||||
public function testNotFound()
|
||||
public function testNotFound(): void
|
||||
{
|
||||
$this->assertEntityNotFound(User::ROLE_USER, '/api/teams/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Team object not found by the @ParamConverter annotation.');
|
||||
}
|
||||
|
||||
public function testDeleteActionWithUnknownTeam()
|
||||
public function testDeleteActionWithUnknownTeam(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->assertNotFoundForDelete($client, '/api/teams/' . PHP_INT_MAX);
|
||||
}
|
||||
|
||||
public function testPostAction()
|
||||
public function testPostAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -106,7 +110,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidUser()
|
||||
public function testPostActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
|
||||
$data = [
|
||||
@@ -118,7 +122,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'Access denied.');
|
||||
}
|
||||
|
||||
public function testPostActionWithValidationErrors()
|
||||
public function testPostActionWithValidationErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -134,7 +138,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['name', 'members.0.user']);
|
||||
}
|
||||
|
||||
public function testPatchAction()
|
||||
public function testPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
@@ -188,7 +192,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertEquals('john_user', $result['members'][0]['user']['username']);
|
||||
}
|
||||
|
||||
public function testPatchActionWithValidationErrors()
|
||||
public function testPatchActionWithValidationErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -214,7 +218,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['name', 'members.0.user']);
|
||||
}
|
||||
|
||||
public function testDeleteAction()
|
||||
public function testDeleteAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$teams = $this->importTeamFixtures();
|
||||
@@ -233,7 +237,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertEmpty($client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testPostMemberAction()
|
||||
public function testPostMemberAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -256,7 +260,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertCount(2, $result['members']);
|
||||
}
|
||||
|
||||
public function testPostMemberActionErrors()
|
||||
public function testPostMemberActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -284,7 +288,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/members/5', 'POST');
|
||||
}
|
||||
|
||||
public function testDeleteMemberAction()
|
||||
public function testDeleteMemberAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -310,7 +314,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertCount(3, $result['members']);
|
||||
}
|
||||
|
||||
public function testDeleteMemberActionErrors()
|
||||
public function testDeleteMemberActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -343,7 +347,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/members/1', 'DELETE');
|
||||
}
|
||||
|
||||
public function testPostCustomerAction()
|
||||
public function testPostCustomerAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -367,7 +371,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertEquals(1, $result['customers'][0]['id']);
|
||||
}
|
||||
|
||||
public function testPostCustomerActionErrors()
|
||||
public function testPostCustomerActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -397,7 +401,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/customers/1', 'POST');
|
||||
}
|
||||
|
||||
public function testDeleteCustomerAction()
|
||||
public function testDeleteCustomerAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -427,9 +431,15 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
self::assertCount(0, $result['customers']);
|
||||
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
$team = $em->getRepository(Team::class)->find($result['id']);
|
||||
self::assertInstanceOf(Team::class, $team);
|
||||
self::assertCount(0, $team->getCustomers());
|
||||
}
|
||||
|
||||
public function testDeleteCustomerActionErrors()
|
||||
public function testDeleteCustomerActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -455,7 +465,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/customers/1', 'DELETE');
|
||||
}
|
||||
|
||||
public function testPostProjectAction()
|
||||
public function testPostProjectAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -478,7 +488,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertEquals(1, $result['projects'][0]['id']);
|
||||
}
|
||||
|
||||
public function testPostProjectActionErrors()
|
||||
public function testPostProjectActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -510,7 +520,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/projects/1', 'POST');
|
||||
}
|
||||
|
||||
public function testDeleteProjectAction()
|
||||
public function testDeleteProjectAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -540,9 +550,15 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertIsArray($result);
|
||||
self::assertApiResponseTypeStructure('TeamEntity', $result);
|
||||
self::assertCount(0, $result['projects']);
|
||||
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
$team = $em->getRepository(Team::class)->find($result['id']);
|
||||
self::assertInstanceOf(Team::class, $team);
|
||||
self::assertCount(0, $team->getProjects());
|
||||
}
|
||||
|
||||
public function testDeleteProjectActionErrors()
|
||||
public function testDeleteProjectActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -568,7 +584,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/projects/1', 'DELETE');
|
||||
}
|
||||
|
||||
public function testPostActivityAction()
|
||||
public function testPostActivityAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -591,7 +607,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertEquals(1, $result['activities'][0]['id']);
|
||||
}
|
||||
|
||||
public function testPostActivityActionErrors()
|
||||
public function testPostActivityActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -621,7 +637,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
$this->assertBadRequest($client, '/api/teams/' . $result['id'] . '/activities/1', 'POST');
|
||||
}
|
||||
|
||||
public function testDeleteActivityAction()
|
||||
public function testDeleteActivityAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -653,7 +669,7 @@ class TeamControllerTest extends APIControllerBaseTest
|
||||
self::assertCount(0, $result['activities']);
|
||||
}
|
||||
|
||||
public function testDeleteActivityActionErrors()
|
||||
public function testDeleteActivityActionErrors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
|
||||
@@ -48,7 +48,7 @@ class SecurityControllerTest extends ControllerBaseTest
|
||||
$this->assertStringContainsString('<form action="/en/login_check" method="post"', $content);
|
||||
$this->assertStringContainsString('<input type="text" id="username" name="_username"', $content);
|
||||
$this->assertStringContainsString('<input id="password" name="_password" type="password"', $content);
|
||||
$this->assertStringContainsString('">Login</button>', $content);
|
||||
$this->assertStringContainsString('">Log in</button>', $content);
|
||||
$this->assertStringContainsString('<input type="hidden" name="_csrf_token" value="', $content);
|
||||
$this->assertStringNotContainsString('<a href="/en/register/"', $content);
|
||||
$this->assertStringNotContainsString('Register a new account', $content);
|
||||
|
||||
@@ -12,8 +12,6 @@ namespace App\Tests\Controller;
|
||||
use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TeamFixtures;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\DomCrawler\Field\ChoiceFormField;
|
||||
use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
|
||||
/**
|
||||
@@ -21,17 +19,17 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser;
|
||||
*/
|
||||
class TeamControllerTest extends ControllerBaseTest
|
||||
{
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/admin/teams/');
|
||||
}
|
||||
|
||||
public function testIsSecureForRole()
|
||||
public function testIsSecureForRole(): void
|
||||
{
|
||||
$this->assertUrlIsSecuredForRole(User::ROLE_TEAMLEAD, '/admin/teams/');
|
||||
}
|
||||
|
||||
public function testIndexAction()
|
||||
public function testIndexAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$em = $this->getEntityManager();
|
||||
@@ -47,7 +45,7 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertDataTableRowCount($client, 'datatable_admin_teams', 6);
|
||||
}
|
||||
|
||||
public function testIndexActionWithSearchTermQuery()
|
||||
public function testIndexActionWithSearchTermQuery(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$fixture = new TeamFixtures();
|
||||
@@ -69,7 +67,7 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertDataTableRowCount($client, 'datatable_admin_teams', 5);
|
||||
}
|
||||
|
||||
public function testCreateAction()
|
||||
public function testCreateAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->assertAccessIsGranted($client, '/admin/teams/create');
|
||||
@@ -90,7 +88,7 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertHasCustomerAndProjectPermissionBoxes($client);
|
||||
}
|
||||
|
||||
protected function assertHasCustomerAndProjectPermissionBoxes(HttpKernelBrowser $client)
|
||||
protected function assertHasCustomerAndProjectPermissionBoxes(HttpKernelBrowser $client): void
|
||||
{
|
||||
$content = $client->getResponse()->getContent();
|
||||
$this->assertStringContainsString('Grant access to customers', $content);
|
||||
@@ -99,7 +97,7 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertEquals(1, $client->getCrawler()->filter('form[name=team_project_form]')->count());
|
||||
}
|
||||
|
||||
public function testEditAction()
|
||||
public function testEditAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
@@ -121,11 +119,10 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertEquals('Test Team 2', $editForm->get('team_edit_form[name]')->getValue());
|
||||
}
|
||||
|
||||
public function testEditMemberAction()
|
||||
public function testEditMemberAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
$em = $this->getEntityManager();
|
||||
$fixture = new TeamFixtures();
|
||||
$fixture->setAmount(2);
|
||||
$this->importFixture($fixture);
|
||||
@@ -143,65 +140,7 @@ class TeamControllerTest extends ControllerBaseTest
|
||||
$this->assertEquals('Test Team 2', $editForm->get('team_edit_form[name]')->getValue());
|
||||
}
|
||||
|
||||
public function testEditCustomerAccessAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$fixture = new TeamFixtures();
|
||||
$fixture->setAmount(2);
|
||||
$fixture->setAddCustomer(false);
|
||||
$this->importFixture($fixture);
|
||||
|
||||
$team = $em->getRepository(Team::class)->find(1);
|
||||
self::assertEquals(0, \count($team->getCustomers()));
|
||||
|
||||
$this->assertAccessIsGranted($client, '/admin/teams/1/edit');
|
||||
$form = $client->getCrawler()->filter('form[name=team_customer_form]')->form();
|
||||
|
||||
/** @var ChoiceFormField $customer */
|
||||
$customer = $form->get('team_customer_form[customers][0]');
|
||||
$customer->tick();
|
||||
|
||||
$client->submit($form);
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/teams/1/edit'));
|
||||
|
||||
$team = $em->getRepository(Team::class)->find(1);
|
||||
self::assertEquals(1, \count($team->getCustomers()));
|
||||
}
|
||||
|
||||
public function testEditProjectAccessAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$fixture = new TeamFixtures();
|
||||
$fixture->setAmount(2);
|
||||
$fixture->setAddCustomer(false);
|
||||
$this->importFixture($fixture);
|
||||
|
||||
$team = $em->getRepository(Team::class)->find(1);
|
||||
self::assertEquals(0, \count($team->getProjects()));
|
||||
|
||||
$this->assertAccessIsGranted($client, '/admin/teams/1/edit');
|
||||
$form = $client->getCrawler()->filter('form[name=team_project_form]')->form();
|
||||
|
||||
/** @var ChoiceFormField $customer */
|
||||
$customer = $form->get('team_project_form[projects]');
|
||||
$customer->select([1]);
|
||||
|
||||
$client->submit($form);
|
||||
$this->assertIsRedirect($client, $this->createUrl('/admin/teams/1/edit'));
|
||||
|
||||
$team = $em->getRepository(Team::class)->find(1);
|
||||
self::assertEquals(1, \count($team->getProjects()));
|
||||
}
|
||||
|
||||
public function testDuplicateAction()
|
||||
public function testDuplicateAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Entity\Project;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Invoice\Calculator\DefaultCalculator;
|
||||
use App\Invoice\InvoiceItemRepositoryInterface;
|
||||
use App\Invoice\InvoiceModel;
|
||||
use App\Invoice\NumberGenerator\DateNumberGenerator;
|
||||
use App\Invoice\Renderer\TwigRenderer;
|
||||
use App\Invoice\ServiceInvoice;
|
||||
@@ -52,7 +53,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
return new ServiceInvoice($repo, new FileHelper(realpath(__DIR__ . '/../../var/data/')), $invoiceRepo, $formattings, (new InvoiceModelFactoryFactory($this))->create());
|
||||
}
|
||||
|
||||
public function testInvalidExceptionOnChangeState()
|
||||
public function testInvalidExceptionOnChangeState(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Unknown invoice status');
|
||||
@@ -60,7 +61,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
$sut->changeInvoiceStatus(new Invoice(), 'foo');
|
||||
}
|
||||
|
||||
public function testEmptyObject()
|
||||
public function testEmptyObject(): void
|
||||
{
|
||||
$sut = $this->getSut([]);
|
||||
|
||||
@@ -78,7 +79,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
$this->assertNull($sut->getNumberGeneratorByName('default'));
|
||||
}
|
||||
|
||||
public function testWithDocumentDirectory()
|
||||
public function testWithDocumentDirectory(): void
|
||||
{
|
||||
$sut = $this->getSut(['templates/invoice/renderer/']);
|
||||
|
||||
@@ -92,7 +93,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
$this->assertInstanceOf(InvoiceDocument::class, $actual);
|
||||
}
|
||||
|
||||
public function testAdd()
|
||||
public function testAdd(): void
|
||||
{
|
||||
$sut = $this->getSut([]);
|
||||
|
||||
@@ -110,7 +111,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
$this->assertEquals(1, \count($sut->getRenderer()));
|
||||
}
|
||||
|
||||
public function testCreateModelThrowsOnMissingTemplate()
|
||||
public function testCreateModelThrowsOnMissingTemplate(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('Cannot create invoice model without template');
|
||||
@@ -122,7 +123,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
$sut->createModel($query);
|
||||
}
|
||||
|
||||
public function testCreateModelUsesTemplateLanguage()
|
||||
public function testCreateModelUsesTemplateLanguage(): void
|
||||
{
|
||||
$template = new InvoiceTemplate();
|
||||
$template->setNumberGenerator('date');
|
||||
@@ -141,7 +142,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
self::assertEquals('it', $model->getTemplate()->getLanguage());
|
||||
}
|
||||
|
||||
public function testBeginAndEndDateFallback()
|
||||
public function testBeginAndEndDateFallback(): void
|
||||
{
|
||||
$timezone = new \DateTimeZone('Europe/Vienna');
|
||||
$customer = new Customer('foo');
|
||||
@@ -207,7 +208,7 @@ class ServiceInvoiceTest extends TestCase
|
||||
self::assertEquals('2020-11-27T23:59:59+0100', $query->getEnd()->format(DATE_ISO8601));
|
||||
}
|
||||
|
||||
public function testCreateModelsSkipsModelsWithNegativeTotal()
|
||||
public function testCreateModelsIncludesModelsWithNegativeTotal(): void
|
||||
{
|
||||
$timezone = new \DateTimeZone('Europe/Vienna');
|
||||
|
||||
@@ -310,12 +311,18 @@ class ServiceInvoiceTest extends TestCase
|
||||
$sut->addInvoiceItemRepository($repo);
|
||||
$models = $sut->createModels($query);
|
||||
|
||||
self::assertCount(2, $models);
|
||||
self::assertEquals(1.73, $models[0]->getCalculator()->getTotal());
|
||||
self::assertEquals(0.0, $models[1]->getCalculator()->getTotal());
|
||||
self::assertCount(4, $models);
|
||||
self::assertInstanceOf(InvoiceModel::class, $models[0]);
|
||||
self::assertEquals(-0.01, $models[0]->getCalculator()->getTotal());
|
||||
self::assertInstanceOf(InvoiceModel::class, $models[1]);
|
||||
self::assertEquals(-100, $models[1]->getCalculator()->getTotal());
|
||||
self::assertInstanceOf(InvoiceModel::class, $models[2]);
|
||||
self::assertEquals(1.73, $models[2]->getCalculator()->getTotal());
|
||||
self::assertInstanceOf(InvoiceModel::class, $models[3]);
|
||||
self::assertEquals(0.0, $models[3]->getCalculator()->getTotal());
|
||||
}
|
||||
|
||||
private function getNumberGeneratorSut()
|
||||
private function getNumberGeneratorSut(): DateNumberGenerator
|
||||
{
|
||||
$repository = $this->createMock(InvoiceRepository::class);
|
||||
$repository
|
||||
|
||||
@@ -1202,151 +1202,6 @@ parameters:
|
||||
count: 4
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:getRoleTestData\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteActionWithUnknownTeam\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteActivityAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteActivityActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteCustomerAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteCustomerActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteMemberAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteMemberActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteProjectAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testDeleteProjectActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testGetCollection\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testGetEntity\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testIsSecure\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testIsSecureForRole\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testNotFound\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPatchAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPatchActionWithValidationErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostActionWithInvalidUser\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostActionWithValidationErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostActivityAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostActivityActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostCustomerAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostCustomerActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostMemberAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostMemberActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostProjectAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\API\\\\TeamControllerTest\\:\\:testPostProjectActionErrors\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: API/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
|
||||
count: 38
|
||||
@@ -4222,76 +4077,11 @@ parameters:
|
||||
count: 2
|
||||
path: Controller/TagControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getCustomers\\(\\) on App\\\\Entity\\\\Team\\|null\\.$#"
|
||||
count: 2
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getProjects\\(\\) on App\\\\Entity\\\\Team\\|null\\.$#"
|
||||
count: 2
|
||||
path: Controller/TeamControllerTest.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: 4
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:assertHasCustomerAndProjectPermissionBoxes\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testCreateAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testDuplicateAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testEditAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testEditCustomerAccessAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testEditMemberAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testEditProjectAccessAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testIndexAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testIndexActionWithSearchTermQuery\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testIsSecure\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\TeamControllerTest\\:\\:testIsSecureForRole\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/TeamControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
|
||||
count: 2
|
||||
@@ -7859,12 +7649,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getTotal\\(\\) on App\\\\Invoice\\\\CalculatorInterface\\|null\\.$#"
|
||||
count: 2
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:getNumberGeneratorSut\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
count: 4
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
@@ -7872,46 +7657,6 @@ parameters:
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testAdd\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testBeginAndEndDateFallback\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testCreateModelThrowsOnMissingTemplate\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testCreateModelUsesTemplateLanguage\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testCreateModelsSkipsModelsWithNegativeTotal\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testEmptyObject\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testInvalidExceptionOnChangeState\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\ServiceInvoiceTest\\:\\:testWithDocumentDirectory\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/ServiceInvoiceTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$dataDir of class App\\\\Utils\\\\FileHelper constructor expects string, string\\|false given\\.$#"
|
||||
count: 1
|
||||
|
||||
Reference in New Issue
Block a user