createMock(EventDispatcherInterface::class), 'foo'); self::assertEquals('foo', $template->getId()); self::assertEquals('default', $template->getTitle()); self::assertEquals('en', $template->getLocale()); self::assertEquals([], $template->getOptions()); $columns = [ 'date', 'begin', 'end', 'duration', 'currency', 'rate', 'internal_rate', 'hourly_rate', 'fixed_rate', 'user.alias', 'user.name', 'user.email', 'user.account_number', 'customer.name', 'project.name', 'activity.name', 'description', 'billable', 'tags', 'type', 'category', 'customer.number', 'project.number', 'customer.vat_id', 'project.order_number', ]; self::assertEquals($columns, $template->getColumns(new TimesheetQuery())); } public function testFullConstructorWithDecimalDurationAndMetaColumns(): void { $dispatcher = new EventDispatcher(); $dispatcher->addSubscriber(new MetaFieldColumnSubscriberMock()); $template = new DefaultTemplate($dispatcher, 'hello', null, 'world'); self::assertEquals('hello', $template->getId()); self::assertEquals('world', $template->getTitle()); self::assertNull($template->getLocale()); self::assertEquals([], $template->getOptions()); $user = new User(); $user->setPreferenceValue('export_decimal', true); $query = new TimesheetQuery(); $query->setCurrentUser($user); $columns = [ 'date', 'begin', 'end', 'duration_decimal', 'currency', 'rate', 'internal_rate', 'hourly_rate', 'fixed_rate', 'user.alias', 'user.name', 'user.email', 'user.account_number', 'customer.name', 'project.name', 'activity.name', 'description', 'billable', 'tags', 'type', 'category', 'customer.number', 'project.number', 'customer.vat_id', 'project.order_number', 'timesheet.meta.foo', 'timesheet.meta.foo2', 'customer.meta.customer-foo', 'project.meta.project-foo', 'project.meta.project-foo2', 'activity.meta.activity-foo', 'user.meta.mypref', ]; self::assertEquals($columns, $template->getColumns($query)); } }