Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -19,26 +19,22 @@ use Faker\Factory;
|
||||
*/
|
||||
final class ActivityFixtures implements TestFixture
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $amount = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isGlobal = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isVisible = null;
|
||||
private int $amount = 0;
|
||||
private bool $isGlobal = false;
|
||||
private ?bool $isVisible = null;
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
private $callback;
|
||||
/**
|
||||
* @var Project[]
|
||||
* @var array<Project>
|
||||
*/
|
||||
private $projects = [];
|
||||
private array $projects = [];
|
||||
|
||||
public function __construct(int $amount = 0)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called prior to persisting the object.
|
||||
@@ -53,9 +49,6 @@ final class ActivityFixtures implements TestFixture
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAmount(): int
|
||||
{
|
||||
return $this->amount;
|
||||
@@ -117,12 +110,10 @@ final class ActivityFixtures implements TestFixture
|
||||
$visible = $this->isVisible;
|
||||
}
|
||||
$activity = new Activity();
|
||||
$activity
|
||||
->setProject($project)
|
||||
->setName($faker->company() . ($visible ? '' : ' (x)'))
|
||||
->setComment($faker->text())
|
||||
->setVisible($visible)
|
||||
;
|
||||
$activity->setProject($project);
|
||||
$activity->setName($faker->company() . ($visible ? '' : ' (x)'));
|
||||
$activity->setComment($faker->text());
|
||||
$activity->setVisible($visible);
|
||||
|
||||
if (null !== $this->callback) {
|
||||
\call_user_func($this->callback, $activity);
|
||||
|
||||
@@ -18,19 +18,18 @@ use Faker\Factory;
|
||||
*/
|
||||
final class CustomerFixtures implements TestFixture
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $amount = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isVisible = null;
|
||||
private int $amount = 0;
|
||||
private ?bool $isVisible = null;
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
private $callback;
|
||||
|
||||
public function __construct(int $amount = 0)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called prior to persisting the object.
|
||||
*
|
||||
@@ -78,18 +77,15 @@ final class CustomerFixtures implements TestFixture
|
||||
if (null !== $this->isVisible) {
|
||||
$visible = $this->isVisible;
|
||||
}
|
||||
$customer = new Customer();
|
||||
$customer
|
||||
->setCurrency($faker->currencyCode())
|
||||
->setName($faker->company() . ($visible ? '' : ' (x)'))
|
||||
->setAddress($faker->address())
|
||||
->setEmail($faker->safeEmail())
|
||||
->setComment($faker->text())
|
||||
->setNumber('C-' . $faker->ean8())
|
||||
->setCountry($faker->countryCode())
|
||||
->setTimezone($faker->timezone())
|
||||
->setVisible($visible)
|
||||
;
|
||||
$customer = new Customer($faker->company() . ($visible ? '' : ' (x)'));
|
||||
$customer->setCurrency($faker->currencyCode());
|
||||
$customer->setAddress($faker->address());
|
||||
$customer->setEmail($faker->safeEmail());
|
||||
$customer->setComment($faker->text());
|
||||
$customer->setNumber('C-' . $faker->ean8());
|
||||
$customer->setCountry($faker->countryCode());
|
||||
$customer->setTimezone($faker->timezone());
|
||||
$customer->setVisible($visible);
|
||||
|
||||
if (null !== $this->callback) {
|
||||
\call_user_func($this->callback, $customer);
|
||||
|
||||
@@ -29,26 +29,25 @@ class InvoiceTemplateFixtures implements TestFixture
|
||||
$faker = Factory::create();
|
||||
|
||||
$template = new InvoiceTemplate();
|
||||
$template
|
||||
->setName('Invoice')
|
||||
->setTitle('Your company name')
|
||||
->setCompany($faker->company())
|
||||
->setVat(19)
|
||||
->setDueDays(14)
|
||||
->setPaymentTerms(
|
||||
'I would like to thank you for your confidence and will gladly be there for you in the future.' .
|
||||
PHP_EOL .
|
||||
'Please transfer the total amount within 14 days to the given account and use the invoice number ' .
|
||||
'as reference.'
|
||||
)
|
||||
->setAddress(
|
||||
$faker->streetAddress() . PHP_EOL .
|
||||
$faker->city() . ' ' . $faker->postcode() . ', ' . $faker->country() . PHP_EOL .
|
||||
'Phone: ' . $faker->phoneNumber() . PHP_EOL .
|
||||
'Email: ' . $faker->safeEmail()
|
||||
)
|
||||
->setLanguage('en')
|
||||
;
|
||||
$template->setName('Invoice');
|
||||
$template->setTitle('Your company name');
|
||||
$template->setCompany($faker->company());
|
||||
$template->setVat(19);
|
||||
$template->setDueDays(14);
|
||||
$template->setPaymentTerms(
|
||||
'I would like to thank you for your confidence and will gladly be there for you in the future.' .
|
||||
PHP_EOL .
|
||||
'Please transfer the total amount within 14 days to the given account and use the invoice number ' .
|
||||
'as reference.'
|
||||
);
|
||||
$template->setAddress(
|
||||
$faker->streetAddress() . PHP_EOL .
|
||||
$faker->city() . ' ' . $faker->postcode() . ', ' . $faker->country() . PHP_EOL .
|
||||
'Phone: ' . $faker->phoneNumber() . PHP_EOL .
|
||||
'Email: ' . $faker->safeEmail()
|
||||
);
|
||||
$template->setLanguage('en');
|
||||
$template->setRenderer('invoice');
|
||||
|
||||
$manager->persist($template);
|
||||
$manager->flush();
|
||||
|
||||
@@ -19,14 +19,8 @@ use Faker\Factory;
|
||||
*/
|
||||
final class ProjectFixtures implements TestFixture
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $amount = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isVisible = null;
|
||||
private int $amount = 0;
|
||||
private ?bool $isVisible = null;
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
@@ -34,7 +28,12 @@ final class ProjectFixtures implements TestFixture
|
||||
/**
|
||||
* @var Customer[]
|
||||
*/
|
||||
private $customers = [];
|
||||
private array $customers = [];
|
||||
|
||||
public function __construct(int $amount = 0)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
public function getAmount(): int
|
||||
{
|
||||
|
||||
@@ -58,6 +58,15 @@ final class TagFixtures implements TestFixture
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function importAmount(int $amount): void
|
||||
{
|
||||
$tags = [];
|
||||
for ($i = 0; $i <= $amount; $i++) {
|
||||
$tags[] = (string) $i;
|
||||
}
|
||||
$this->setTagArray($tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ObjectManager $manager
|
||||
* @return Tag[]
|
||||
|
||||
@@ -106,8 +106,7 @@ final class TeamFixtures implements TestFixture
|
||||
}
|
||||
}
|
||||
|
||||
$team = new Team();
|
||||
$team->setName('Testing: ' . uniqid());
|
||||
$team = new Team('Testing: ' . uniqid());
|
||||
$team->addTeamlead($lead);
|
||||
|
||||
if ($this->addUser) {
|
||||
|
||||
@@ -412,13 +412,12 @@ final class TimesheetFixtures implements TestFixture
|
||||
$rate = Util::calculateRate($hourlyRate, $duration);
|
||||
|
||||
$entry = new Timesheet();
|
||||
$entry
|
||||
->setActivity($activity)
|
||||
->setProject($project)
|
||||
->setDescription($description)
|
||||
->setUser($user)
|
||||
->setRate($rate)
|
||||
->setBegin($start);
|
||||
$entry->setActivity($activity);
|
||||
$entry->setProject($project);
|
||||
$entry->setDescription($description);
|
||||
$entry->setUser($user);
|
||||
$entry->setRate($rate);
|
||||
$entry->setBegin($start);
|
||||
|
||||
if (\count($tagArray) > 0) {
|
||||
foreach ($tagArray as $item) {
|
||||
@@ -439,10 +438,8 @@ final class TimesheetFixtures implements TestFixture
|
||||
}
|
||||
|
||||
if ($setEndDate) {
|
||||
$entry
|
||||
->setEnd($end)
|
||||
->setDuration($duration)
|
||||
;
|
||||
$entry->setEnd($end);
|
||||
$entry->setDuration($duration);
|
||||
}
|
||||
|
||||
return $entry;
|
||||
|
||||
Reference in New Issue
Block a user