diff --git a/src/Form/TimesheetEditForm.php b/src/Form/TimesheetEditForm.php index e13a93c4..1ddf27f2 100644 --- a/src/Form/TimesheetEditForm.php +++ b/src/Form/TimesheetEditForm.php @@ -10,6 +10,9 @@ namespace App\Form; use App\Configuration\TimesheetConfiguration; +use App\Entity\Activity; +use App\Entity\Customer; +use App\Entity\Project; use App\Entity\Timesheet; use App\Form\Type\ActivityType; use App\Form\Type\CustomerType; @@ -80,6 +83,7 @@ class TimesheetEditForm extends AbstractType $end = null; $begin = null; $customerCount = $this->customers->countCustomer(true); + $projectCount = $this->projects->countProject(true); $isNew = true; if (isset($options['data'])) { @@ -123,51 +127,13 @@ class TimesheetEditForm extends AbstractType } if ($isNew || null === $end || !$this->configuration->isDurationOnly()) { - $builder->add('begin', DateTimePickerType::class, array_merge($dateTimeOptions, [ - 'label' => 'label.begin' - ])); + $this->addBegin($builder, $dateTimeOptions); } if ($this->configuration->isDurationOnly()) { - $builder->add('duration', DurationType::class, [ - 'required' => false, - 'docu_chapter' => 'timesheet.html#duration-format', - 'attr' => [ - 'placeholder' => '00:00', - ] - ]); - - $builder->addEventListener( - FormEvents::POST_SET_DATA, - function (FormEvent $event) { - /** @var Timesheet $data */ - $data = $event->getData(); - if (null === $data || null === $data->getEnd()) { - $event->getForm()->get('duration')->setData(null); - } - } - ); - - // make sure that duration is mapped back to end field - $builder->addEventListener( - FormEvents::SUBMIT, - function (FormEvent $event) { - /** @var Timesheet $data */ - $data = $event->getData(); - $duration = $data->getDuration(); - $end = null; - if (null !== $duration) { - $end = clone $data->getBegin(); - $end->modify('+ ' . $duration . 'seconds'); - } - $data->setEnd($end); - } - ); + $this->addDuration($builder); } else { - $builder->add('end', DateTimePickerType::class, array_merge($dateTimeOptions, [ - 'label' => 'label.end', - 'required' => false, - ])); + $this->addEnd($builder, $dateTimeOptions); } $projectOptions = []; @@ -175,35 +141,60 @@ class TimesheetEditForm extends AbstractType if ($customerCount < 2) { $projectOptions['group_by'] = null; } elseif ($options['customer']) { - $builder - ->add('customer', CustomerType::class, [ - 'query_builder' => function (CustomerRepository $repo) use ($customer) { - return $repo->builderForEntityType($customer); - }, - 'data' => $customer ? $customer : '', - 'required' => false, - 'placeholder' => null === $customer ? '' : null, - 'mapped' => false, - 'project_enabled' => true, - ]); + $this->addCustomer($builder, $customer); } - if ($this->projects->countProject(true) <= 1) { + if ($projectCount <= 1) { $projectOptions['group_by'] = null; } + $this->addProject($builder, $projectOptions, $project, $customer); + $this->addActivity($builder, $activity, $project); + $this->addDescription($builder); + $this->addTags($builder); + + if ($options['include_rate']) { + $this->addRates($builder, $currency); + } + + if ($options['include_user']) { + $this->addUser($builder); + } + + if ($options['include_exported']) { + $this->addExported($builder); + } + } + + protected function addCustomer(FormBuilderInterface $builder, ?Customer $customer = null) + { + $builder + ->add('customer', CustomerType::class, [ + 'query_builder' => function (CustomerRepository $repo) use ($customer) { + return $repo->builderForEntityType($customer); + }, + 'data' => $customer ? $customer : '', + 'required' => false, + 'placeholder' => null === $customer ? '' : null, + 'mapped' => false, + 'project_enabled' => true, + ]); + } + + protected function addProject(FormBuilderInterface $builder, array $projectOptions, ?Project $project = null, ?Customer $customer = null) + { $builder ->add( 'project', ProjectType::class, array_merge($projectOptions, [ - 'placeholder' => '', - 'activity_enabled' => true, - 'query_builder' => function (ProjectRepository $repo) use ($project, $customer) { - return $repo->builderForEntityType($project, $customer); - }, - ]) - ); + 'placeholder' => '', + 'activity_enabled' => true, + 'query_builder' => function (ProjectRepository $repo) use ($project, $customer) { + return $repo->builderForEntityType($project, $customer); + }, + ]) + ); // replaces the project select after submission, to make sure only projects for the selected customer are displayed $builder->addEventListener( @@ -224,7 +215,10 @@ class TimesheetEditForm extends AbstractType ]); } ); + } + protected function addActivity(FormBuilderInterface $builder, ?Activity $activity = null, ?Project $project = null) + { $builder ->add('activity', ActivityType::class, [ 'placeholder' => '', @@ -251,13 +245,72 @@ class TimesheetEditForm extends AbstractType ]); } ); + } + protected function addBegin(FormBuilderInterface $builder, array $dateTimeOptions) + { + $builder->add('begin', DateTimePickerType::class, array_merge($dateTimeOptions, [ + 'label' => 'label.begin' + ])); + } + + protected function addEnd(FormBuilderInterface $builder, array $dateTimeOptions) + { + $builder->add('end', DateTimePickerType::class, array_merge($dateTimeOptions, [ + 'label' => 'label.end', + 'required' => false, + ])); + } + + protected function addDuration(FormBuilderInterface $builder) + { + $builder->add('duration', DurationType::class, [ + 'required' => false, + 'docu_chapter' => 'timesheet.html#duration-format', + 'attr' => [ + 'placeholder' => '00:00', + ] + ]); + + $builder->addEventListener( + FormEvents::POST_SET_DATA, + function (FormEvent $event) { + /** @var Timesheet $data */ + $data = $event->getData(); + if (null === $data || null === $data->getEnd()) { + $event->getForm()->get('duration')->setData(null); + } + } + ); + + // make sure that duration is mapped back to end field + $builder->addEventListener( + FormEvents::SUBMIT, + function (FormEvent $event) { + /** @var Timesheet $data */ + $data = $event->getData(); + $duration = $data->getDuration(); + $end = null; + if (null !== $duration) { + $end = clone $data->getBegin(); + $end->modify('+ ' . $duration . 'seconds'); + } + $data->setEnd($end); + } + ); + } + + protected function addDescription(FormBuilderInterface $builder) + { $builder ->add('description', TextareaType::class, [ 'label' => 'label.description', 'required' => false, ]); + } + protected function addTags(FormBuilderInterface $builder) + { $builder ->add('tags', TagsInputType::class, [ // documentation is for NelmioApiDocBundle @@ -267,26 +320,29 @@ class TimesheetEditForm extends AbstractType ], 'required' => false, ]); + } - if ($options['include_rate']) { - $builder - ->add('fixedRate', FixedRateType::class, [ - 'currency' => $currency, - ]) - ->add('hourlyRate', HourlyRateType::class, [ - 'currency' => $currency, - ]); - } - - if ($options['include_user']) { - $builder->add('user', UserType::class); - } - - if ($options['include_exported']) { - $builder->add('exported', YesNoType::class, [ - 'label' => 'label.exported' + protected function addRates(FormBuilderInterface $builder, $currency) + { + $builder + ->add('fixedRate', FixedRateType::class, [ + 'currency' => $currency, + ]) + ->add('hourlyRate', HourlyRateType::class, [ + 'currency' => $currency, ]); - } + } + + protected function addUser(FormBuilderInterface $builder) + { + $builder->add('user', UserType::class); + } + + protected function addExported(FormBuilderInterface $builder) + { + $builder->add('exported', YesNoType::class, [ + 'label' => 'label.exported' + ]); } /** diff --git a/tests/API/ActivityControllerTest.php b/tests/API/ActivityControllerTest.php index 5376601a..f6928716 100644 --- a/tests/API/ActivityControllerTest.php +++ b/tests/API/ActivityControllerTest.php @@ -17,7 +17,6 @@ use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Component\HttpFoundation\Response; /** - * @coversDefaultClass \App\API\ActivityController * @group integration */ class ActivityControllerTest extends APIControllerBaseTest diff --git a/tests/API/ConfigurationControllerTest.php b/tests/API/ConfigurationControllerTest.php index 6ae90edd..7cf56cb6 100644 --- a/tests/API/ConfigurationControllerTest.php +++ b/tests/API/ConfigurationControllerTest.php @@ -12,7 +12,6 @@ namespace App\Tests\API; use App\Entity\User; /** - * @coversDefaultClass \App\API\ConfigurationController * @group integration */ class ConfigurationControllerTest extends APIControllerBaseTest diff --git a/tests/API/CustomerControllerTest.php b/tests/API/CustomerControllerTest.php index 0c2eece7..f682d1dc 100644 --- a/tests/API/CustomerControllerTest.php +++ b/tests/API/CustomerControllerTest.php @@ -13,7 +13,6 @@ use App\Entity\User; use Symfony\Component\HttpFoundation\Response; /** - * @coversDefaultClass \App\API\CustomerController * @group integration */ class CustomerControllerTest extends APIControllerBaseTest diff --git a/tests/API/Model/I18nTest.php b/tests/API/Model/I18nTest.php index 4cafa433..6cd7e1cc 100644 --- a/tests/API/Model/I18nTest.php +++ b/tests/API/Model/I18nTest.php @@ -13,7 +13,7 @@ use App\API\Model\I18n; use PHPUnit\Framework\TestCase; /** - * @coversDefaultClass \App\API\Model\I18n + * @covers \App\API\Model\I18n */ class I18nTest extends TestCase { diff --git a/tests/API/ProjectControllerTest.php b/tests/API/ProjectControllerTest.php index 8170a4b1..a85b52f7 100644 --- a/tests/API/ProjectControllerTest.php +++ b/tests/API/ProjectControllerTest.php @@ -17,7 +17,6 @@ use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Component\HttpFoundation\Response; /** - * @coversDefaultClass \App\API\ProjectController * @group integration */ class ProjectControllerTest extends APIControllerBaseTest diff --git a/tests/API/StatusControllerTest.php b/tests/API/StatusControllerTest.php index 1e2892be..94514798 100644 --- a/tests/API/StatusControllerTest.php +++ b/tests/API/StatusControllerTest.php @@ -13,7 +13,6 @@ use App\Constants; use App\Entity\User; /** - * @coversDefaultClass \App\API\StatusController * @group integration */ class StatusControllerTest extends APIControllerBaseTest diff --git a/tests/API/TagControllerTest.php b/tests/API/TagControllerTest.php index 60781bcb..82133281 100644 --- a/tests/API/TagControllerTest.php +++ b/tests/API/TagControllerTest.php @@ -14,7 +14,6 @@ use App\Tests\DataFixtures\TagFixtures; use Symfony\Component\HttpFoundation\Response; /** - * @coversDefaultClass \App\API\TagController * @group integration */ class TagControllerTest extends APIControllerBaseTest diff --git a/tests/API/TimesheetControllerTest.php b/tests/API/TimesheetControllerTest.php index 33f73c3d..586dc365 100644 --- a/tests/API/TimesheetControllerTest.php +++ b/tests/API/TimesheetControllerTest.php @@ -18,7 +18,6 @@ use App\Tests\DataFixtures\TimesheetFixtures; use Symfony\Component\HttpFoundation\Response; /** - * @coversDefaultClass \App\API\TimesheetController * @group integration */ class TimesheetControllerTest extends APIControllerBaseTest diff --git a/tests/API/UserControllerTest.php b/tests/API/UserControllerTest.php index 97d7d9d1..5aae1446 100644 --- a/tests/API/UserControllerTest.php +++ b/tests/API/UserControllerTest.php @@ -12,7 +12,6 @@ namespace App\Tests\API; use App\Entity\User; /** - * @coversDefaultClass \App\API\UserController * @group integration */ class UserControllerTest extends APIControllerBaseTest diff --git a/tests/Calendar/GoogleTest.php b/tests/Calendar/GoogleTest.php index 82092902..e62be1cf 100644 --- a/tests/Calendar/GoogleTest.php +++ b/tests/Calendar/GoogleTest.php @@ -14,7 +14,7 @@ use App\Calendar\Source; use PHPUnit\Framework\TestCase; /** - * @coversDefaultClass \App\Calendar\Google + * @covers \App\Calendar\Google */ class GoogleTest extends TestCase { diff --git a/tests/Calendar/SourceTest.php b/tests/Calendar/SourceTest.php index e16bbd66..cb260640 100644 --- a/tests/Calendar/SourceTest.php +++ b/tests/Calendar/SourceTest.php @@ -13,7 +13,7 @@ use App\Calendar\Source; use PHPUnit\Framework\TestCase; /** - * @coversDefaultClass \App\Calendar\Source + * @covers \App\Calendar\Source */ class SourceTest extends TestCase { diff --git a/tests/Command/CreateUserCommandTest.php b/tests/Command/CreateUserCommandTest.php index 37157704..9f2e9c0b 100644 --- a/tests/Command/CreateUserCommandTest.php +++ b/tests/Command/CreateUserCommandTest.php @@ -16,7 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Console\Tester\CommandTester; /** - * @coversDefaultClass \App\Command\CreateUserCommand + * @covers \App\Command\CreateUserCommand * @group integration */ class CreateUserCommandTest extends KernelTestCase diff --git a/tests/Controller/AboutControllerTest.php b/tests/Controller/AboutControllerTest.php index 277f9ffa..d0e856ed 100644 --- a/tests/Controller/AboutControllerTest.php +++ b/tests/Controller/AboutControllerTest.php @@ -12,7 +12,6 @@ namespace App\Tests\Controller; use App\Entity\User; /** - * @coversDefaultClass \App\Controller\AboutController * @group integration */ class AboutControllerTest extends ControllerBaseTest diff --git a/tests/Controller/ActivityControllerTest.php b/tests/Controller/ActivityControllerTest.php index bd663363..06367858 100644 --- a/tests/Controller/ActivityControllerTest.php +++ b/tests/Controller/ActivityControllerTest.php @@ -16,7 +16,6 @@ use App\Tests\DataFixtures\ProjectFixtures; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\ActivityController * @group integration */ class ActivityControllerTest extends ControllerBaseTest diff --git a/tests/Controller/CalendarControllerTest.php b/tests/Controller/CalendarControllerTest.php index c9b33eab..20d4eae9 100644 --- a/tests/Controller/CalendarControllerTest.php +++ b/tests/Controller/CalendarControllerTest.php @@ -13,7 +13,6 @@ use App\Configuration\CalendarConfiguration; use App\Tests\Configuration\TestConfigLoader; /** - * @coversDefaultClass \App\Controller\CalendarController * @group integration */ class CalendarControllerTest extends ControllerBaseTest diff --git a/tests/Controller/CustomerControllerTest.php b/tests/Controller/CustomerControllerTest.php index caad44f6..bcd6e98a 100644 --- a/tests/Controller/CustomerControllerTest.php +++ b/tests/Controller/CustomerControllerTest.php @@ -15,7 +15,6 @@ use App\Tests\DataFixtures\CustomerFixtures; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\CustomerController * @group integration */ class CustomerControllerTest extends ControllerBaseTest diff --git a/tests/Controller/DashboardControllerTest.php b/tests/Controller/DashboardControllerTest.php index 09d91514..b0cc0e42 100644 --- a/tests/Controller/DashboardControllerTest.php +++ b/tests/Controller/DashboardControllerTest.php @@ -12,7 +12,6 @@ namespace App\Tests\Controller; use App\Entity\User; /** - * @coversDefaultClass \App\Controller\DashboardController * @group integration */ class DashboardControllerTest extends ControllerBaseTest diff --git a/tests/Controller/ExportControllerTest.php b/tests/Controller/ExportControllerTest.php index 54cc20dd..6a297414 100644 --- a/tests/Controller/ExportControllerTest.php +++ b/tests/Controller/ExportControllerTest.php @@ -13,7 +13,6 @@ use App\Entity\User; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\ExportController * @group integration */ class ExportControllerTest extends ControllerBaseTest diff --git a/tests/Controller/HomepageControllerTest.php b/tests/Controller/HomepageControllerTest.php index 09ef1e30..18a49ac7 100644 --- a/tests/Controller/HomepageControllerTest.php +++ b/tests/Controller/HomepageControllerTest.php @@ -15,7 +15,6 @@ use App\Form\Type\InitialViewType; use App\Form\Type\LanguageType; /** - * @coversDefaultClass \App\Controller\HomepageController * @group integration */ class HomepageControllerTest extends ControllerBaseTest diff --git a/tests/Controller/InvoiceControllerTest.php b/tests/Controller/InvoiceControllerTest.php index f69e8ea2..d91fcb58 100644 --- a/tests/Controller/InvoiceControllerTest.php +++ b/tests/Controller/InvoiceControllerTest.php @@ -16,7 +16,6 @@ use App\Tests\DataFixtures\InvoiceFixtures; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\InvoiceController * @group integration */ class InvoiceControllerTest extends ControllerBaseTest diff --git a/tests/Controller/PluginControllerTest.php b/tests/Controller/PluginControllerTest.php index 71c5d6df..40d4eb5f 100644 --- a/tests/Controller/PluginControllerTest.php +++ b/tests/Controller/PluginControllerTest.php @@ -14,7 +14,6 @@ use App\Plugin\PluginManager; use App\Tests\Plugin\Fixtures\TestPlugin; /** - * @coversDefaultClass \App\Controller\PluginController * @group integration */ class PluginControllerTest extends ControllerBaseTest diff --git a/tests/Controller/ProfileControllerTest.php b/tests/Controller/ProfileControllerTest.php index 6ac35aab..b19c544f 100644 --- a/tests/Controller/ProfileControllerTest.php +++ b/tests/Controller/ProfileControllerTest.php @@ -17,7 +17,6 @@ use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; /** - * @coversDefaultClass \App\Controller\ProfileController * @group integration */ class ProfileControllerTest extends ControllerBaseTest diff --git a/tests/Controller/ProjectControllerTest.php b/tests/Controller/ProjectControllerTest.php index 88c239cb..700d6288 100644 --- a/tests/Controller/ProjectControllerTest.php +++ b/tests/Controller/ProjectControllerTest.php @@ -16,7 +16,6 @@ use App\Tests\DataFixtures\ProjectFixtures; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\ProjectController * @group integration */ class ProjectControllerTest extends ControllerBaseTest diff --git a/tests/Controller/SecurityControllerTest.php b/tests/Controller/SecurityControllerTest.php index ce4423f3..a67f0ec0 100644 --- a/tests/Controller/SecurityControllerTest.php +++ b/tests/Controller/SecurityControllerTest.php @@ -11,7 +11,7 @@ namespace App\Tests\Controller; /** * This test makes sure the login and registration work as expected. - * They live in the FOSUserBundle and are tested already, but we use a different layout. + * The logic is located in the FOSUserBundle and already tested, but we use a different layout. * * @group integration */ diff --git a/tests/Controller/SystemConfigurationControllerTest.php b/tests/Controller/SystemConfigurationControllerTest.php index add9a8a8..716f7344 100644 --- a/tests/Controller/SystemConfigurationControllerTest.php +++ b/tests/Controller/SystemConfigurationControllerTest.php @@ -13,7 +13,6 @@ use App\Configuration\SystemConfiguration; use App\Entity\User; /** - * @coversDefaultClass \App\Controller\SystemConfigurationController * @group integration */ class SystemConfigurationControllerTest extends ControllerBaseTest diff --git a/tests/Controller/TagControllerTest.php b/tests/Controller/TagControllerTest.php index 9ddae6c1..a2319017 100644 --- a/tests/Controller/TagControllerTest.php +++ b/tests/Controller/TagControllerTest.php @@ -13,7 +13,6 @@ use App\Entity\User; use App\Tests\DataFixtures\TagFixtures; /** - * @coversDefaultClass \App\Controller\TagController * @group integration */ class TagControllerTest extends ControllerBaseTest diff --git a/tests/Controller/TimesheetControllerTest.php b/tests/Controller/TimesheetControllerTest.php index 627a8502..68027e3a 100644 --- a/tests/Controller/TimesheetControllerTest.php +++ b/tests/Controller/TimesheetControllerTest.php @@ -15,7 +15,6 @@ use App\Form\Type\DateRangeType; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\TimesheetController * @group integration */ class TimesheetControllerTest extends ControllerBaseTest diff --git a/tests/Controller/TimesheetTeamControllerTest.php b/tests/Controller/TimesheetTeamControllerTest.php index 256da66e..d761cabf 100644 --- a/tests/Controller/TimesheetTeamControllerTest.php +++ b/tests/Controller/TimesheetTeamControllerTest.php @@ -15,7 +15,6 @@ use App\Form\Type\DateRangeType; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\TimesheetTeamController * @group integration */ class TimesheetTeamControllerTest extends ControllerBaseTest diff --git a/tests/Controller/UserControllerTest.php b/tests/Controller/UserControllerTest.php index 33d8b883..da42108f 100644 --- a/tests/Controller/UserControllerTest.php +++ b/tests/Controller/UserControllerTest.php @@ -14,7 +14,6 @@ use App\Entity\User; use App\Tests\DataFixtures\TimesheetFixtures; /** - * @coversDefaultClass \App\Controller\UserController * @group integration */ class UserControllerTest extends ControllerBaseTest diff --git a/tests/Entity/UserTest.php b/tests/Entity/UserTest.php index 06745321..b47a5e39 100644 --- a/tests/Entity/UserTest.php +++ b/tests/Entity/UserTest.php @@ -11,12 +11,35 @@ namespace App\Tests\Entity; use App\Entity\User; use App\Entity\UserPreference; +use Doctrine\Common\Collections\ArrayCollection; /** * @covers \App\Entity\User */ class UserTest extends AbstractEntityTest { + public function testDefaultValues() + { + $user = new User(); + $this->assertInstanceOf(ArrayCollection::class, $user->getPreferences()); + $this->assertNull($user->getTitle()); + $this->assertNull($user->getAvatar()); + $this->assertNull($user->getAlias()); + $this->assertNull($user->getId()); + $this->assertNull($user->getApiToken()); + $this->assertNull($user->getPlainApiToken()); + $this->assertEquals(User::DEFAULT_LANGUAGE, $user->getLocale()); + + $user->setAvatar('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=retro&f=y'); + $this->assertEquals('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=retro&f=y', $user->getAvatar()); + $user->setApiToken('nbvfdswe34567ujko098765rerfghbgvfcdsert'); + $this->assertEquals('nbvfdswe34567ujko098765rerfghbgvfcdsert', $user->getApiToken()); + $user->setPlainApiToken('https://www.gravatar.com/avatar/nbvfdswe34567ujko098765rerfghbgvfcdsert'); + $this->assertEquals('https://www.gravatar.com/avatar/nbvfdswe34567ujko098765rerfghbgvfcdsert', $user->getPlainApiToken()); + $user->setTitle('Mr. Code Blaster'); + $this->assertEquals('Mr. Code Blaster', $user->getTitle()); + } + public function getInvalidTestData() { return [ diff --git a/tests/Event/ThemeEventTest.php b/tests/Event/ThemeEventTest.php new file mode 100644 index 00000000..65099c90 --- /dev/null +++ b/tests/Event/ThemeEventTest.php @@ -0,0 +1,56 @@ +setAlias('foo'); + + $sut = new ThemeEvent($user); + + $this->assertEquals($user, $sut->getUser()); + $this->assertNull($sut->getPayload()); + $this->assertEquals('', $sut->getContent()); + } + + public function testGetterAndSetter() + { + $user = new User(); + $user->setAlias('foo'); + + $payload = [null, '', 'test', new \stdClass()]; + + $sut = new ThemeEvent($user); + $sut->setPayload($payload); + $this->assertEquals($payload, $sut->getPayload()); + + $sut = new ThemeEvent($user, $payload); + $this->assertEquals($payload, $sut->getPayload()); + + $sut = new ThemeEvent($user); + $sut->addContent('foo'); + $this->assertEquals('foo', $sut->getContent()); + + $sut->addContent('