From a332026d6d19e2b97ac638f5d5f8855ac14241af Mon Sep 17 00:00:00 2001 From: Patrick Jenkner Date: Fri, 26 Jul 2024 11:42:15 +0200 Subject: [PATCH 1/5] added unit tests to ci workflow, fixed/updated composer.json --- .github/workflows/ci.yaml | 15 +++++++++++++-- Tests/bootstrap.php | 9 +++++++++ composer.json | 22 ++++++++++++++++++++++ phpunit.xml.dist | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 Tests/bootstrap.php create mode 100644 phpunit.xml.dist diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index de91768..5a30517 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,7 @@ name: Continous Integration on: push: branches: - - master + - mautic5-support - '[0-9]+\-[0-9]+\-x' pull_request: @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - php-version: [ 8.0 ] + php-version: [ 8.1 ] steps: - name: Checkout uses: actions/checkout@v2 @@ -24,3 +24,14 @@ jobs: run: composer install - name: Check PHP CS run: ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --dry-run --using-cache no --show-progress dots -v + - name: Run PHPUnit + run: ./vendor/bin/phpunit --testsuite unit --coverage-cobertura=coverage.xml + - name: Code Coverage + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage.xml + badge: true + format: 'markdown' + output: 'both' + - name: Write to Job Summary + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php new file mode 100644 index 0000000..a9e7e51 --- /dev/null +++ b/Tests/bootstrap.php @@ -0,0 +1,9 @@ +=8.0.0", "mautic/core-lib": "^5.0" }, + "require-dev": { + "phpunit/phpunit": ">=9.5" + }, "scripts": { "test": [ "@phpunit", @@ -42,5 +45,24 @@ "name": "Rahul Shinde", "email": "shinde.r.a@gmail.com" } + ], + "autoload": { + "psr-4": { + "MauticPlugin\\LeuchtfeuerGoToBundle\\": "" + } + }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/mautic/FOSOAuthServerBundle.git" + }, + { + "type": "git", + "url": "https://github.com/mautic/SpBundle.git" + }, + { + "type": "git", + "url": "https://github.com/mautic/SymfonyBridgeBundle.git" + } ] } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..22b762a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,32 @@ + + + + + + * + + + Config + Tests + vendor + + + + + Tests/Unit + + + Tests/Functional + + + Tests/Unit + Tests/Functional + + + + + + + + From 69ef295017606ab2c9b6368abe580779e3cce8f9 Mon Sep 17 00:00:00 2001 From: Patrick Jenkner Date: Wed, 7 Aug 2024 15:05:30 +0200 Subject: [PATCH 2/5] require cs-fixer --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index fd37bcd..2d5a9d7 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "mautic/core-lib": "^5.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.4", "phpunit/phpunit": ">=9.5" }, "scripts": { From 2fb11cb99c91b5d92331a7cd002e92daa9d98e5f Mon Sep 17 00:00:00 2001 From: Patrick Jenkner Date: Wed, 14 Aug 2024 14:33:26 +0200 Subject: [PATCH 3/5] apply cs fixer --- Api/GototrainingApi.php | 2 +- Api/GotowebinarApi.php | 2 +- Command/SyncCommand.php | 3 - Entity/GoToEvent.php | 3 - Entity/GoToEventRepository.php | 8 +-- Entity/GoToProduct.php | 18 ----- Entity/GoToProductRepository.php | 4 +- EventListener/FormSubscriber.php | 12 ++-- EventListener/LeadSubscriber.php | 1 - EventListener/PluginEventSubscriber.php | 3 - Form/Type/GoToActionType.php | 26 ++++---- Form/Type/GoToCampaignActionType.php | 2 - Form/Type/GoToCampaignEventType.php | 2 - Form/Type/GoToListType.php | 5 -- Helper/BasicEnum.php | 3 - Helper/GoToHelper.php | 11 ---- Integration/GoToAbstractIntegration.php | 17 ----- LeuchtfeuerGoToBundle.php | 80 +++++++++++------------ Model/GoToModel.php | 14 ++-- Tests/DataFixtures/ORM/LoadCitrixData.php | 2 +- 20 files changed, 71 insertions(+), 147 deletions(-) diff --git a/Api/GototrainingApi.php b/Api/GototrainingApi.php index 5fe665f..017db04 100644 --- a/Api/GototrainingApi.php +++ b/Api/GototrainingApi.php @@ -10,7 +10,7 @@ class GototrainingApi use GoToApi; public function __construct( - private GototrainingIntegration $integration + private GototrainingIntegration $integration ) { } diff --git a/Api/GotowebinarApi.php b/Api/GotowebinarApi.php index 841f727..7ebaf87 100644 --- a/Api/GotowebinarApi.php +++ b/Api/GotowebinarApi.php @@ -19,7 +19,7 @@ public function __construct( * * @throws ApiErrorException */ - public function request(string $operation, array $parameters = [], string $method = 'GET', string $organizerKey = null): mixed + public function request(string $operation, array $parameters = [], string $method = 'GET', ?string $organizerKey = null): mixed { $settings = [ 'module' => 'G2W', diff --git a/Command/SyncCommand.php b/Command/SyncCommand.php index 4996e05..e464662 100644 --- a/Command/SyncCommand.php +++ b/Command/SyncCommand.php @@ -57,9 +57,6 @@ protected function configure(): void parent::configure(); } - /** - * {@inheritdoc} - */ protected function execute(InputInterface $input, OutputInterface $output): int { $options = $input->getOptions(); diff --git a/Entity/GoToEvent.php b/Entity/GoToEvent.php index c7767c2..f3c4543 100644 --- a/Entity/GoToEvent.php +++ b/Entity/GoToEvent.php @@ -102,9 +102,6 @@ public function setEventType(string $eventType): static return $this; } - /** - * @param mixed $joinUrl - */ public function setJoinUrl($joinUrl): void { $this->joinUrl = $joinUrl; diff --git a/Entity/GoToEventRepository.php b/Entity/GoToEventRepository.php index f40bbe7..895a61e 100644 --- a/Entity/GoToEventRepository.php +++ b/Entity/GoToEventRepository.php @@ -18,11 +18,9 @@ class GoToEventRepository extends CommonRepository /** * Fetch the base event data from the database. * - * @return mixed - * * @throws \InvalidArgumentException */ - public function getEvents(string $product, string $eventType, \DateTime $fromDate = null) + public function getEvents(string $product, string $eventType, ?\DateTime $fromDate = null) { $q = $this->createQueryBuilder('c'); @@ -50,7 +48,7 @@ public function getEvents(string $product, string $eventType, \DateTime $fromDat * * @return mixed[] */ - public function getEventsForTimeline(mixed $product, int $leadId = null, array $options = []): array + public function getEventsForTimeline(mixed $product, ?int $leadId = null, array $options = []): array { $eventType = null; if (is_array($product)) { @@ -160,7 +158,6 @@ public function getEntities(array $args = []): Paginator /** * @param QueryBuilder|\Doctrine\DBAL\Query\QueryBuilder $qb - * @param mixed $filter * * @return mixed[] */ @@ -172,7 +169,6 @@ protected function addCatchAllWhereClause($qb, $filter): array /** * @param QueryBuilder|\Doctrine\DBAL\Query\QueryBuilder $q - * @param mixed $filter * * @return mixed[] */ diff --git a/Entity/GoToProduct.php b/Entity/GoToProduct.php index a4e6f9a..2163a66 100644 --- a/Entity/GoToProduct.php +++ b/Entity/GoToProduct.php @@ -44,49 +44,31 @@ public static function loadMetadata(ClassMetadata $metadata): void $builder->addNamedField('status', 'text', 'status', true); } - /** - * @return mixed - */ public function getId() { return $this->id; } - /** - * @param mixed $id - */ public function setId($id): void { $this->id = $id; } - /** - * @return mixed - */ public function getProductKey() { return $this->product_key; } - /** - * @param mixed $product_key - */ public function setProductKey($product_key): void { $this->product_key = $product_key; } - /** - * @return mixed - */ public function getOrganizerKey() { return $this->organizer_key; } - /** - * @param mixed $organizer_key - */ public function setOrganizerKey($organizer_key): void { $this->organizer_key = $organizer_key; diff --git a/Entity/GoToProductRepository.php b/Entity/GoToProductRepository.php index a5f3fbe..c4740ad 100644 --- a/Entity/GoToProductRepository.php +++ b/Entity/GoToProductRepository.php @@ -71,7 +71,7 @@ public function getFutureProducts(): mixed /** * @throws \Exception */ - public function getProductsBetweenSpecificDates(\DateTime $from = null, \DateTime $to = null): mixed + public function getProductsBetweenSpecificDates(?\DateTime $from = null, ?\DateTime $to = null): mixed { if (null === $to) { $to = new \DateTime('now + 50 years'); @@ -81,7 +81,7 @@ public function getProductsBetweenSpecificDates(\DateTime $from = null, \DateTim $from = new \DateTime('now - 10 years'); } - $qb = $this->createQueryBuilder('e'); + $qb = $this->createQueryBuilder('e'); $expr = $qb->expr(); $qb ->andWhere('e.date BETWEEN :from AND :to') diff --git a/EventListener/FormSubscriber.php b/EventListener/FormSubscriber.php index 2e826d9..eb19860 100644 --- a/EventListener/FormSubscriber.php +++ b/EventListener/FormSubscriber.php @@ -81,7 +81,7 @@ public static function getSubscribedEvents(): array /** * @throws ValidationException */ - private function _doRegistration(SubmissionEvent $event, string $product, string $startType = null): void + private function _doRegistration(SubmissionEvent $event, string $product, ?string $startType = null): void { $submission = $event->getSubmission(); $form = $submission->getForm(); @@ -224,11 +224,11 @@ public function onAssistRemote(SubmissionEvent $event): void public function onResponse(PluginIntegrationRequestEvent $event): void { // /** @var Response $response */ -// $response = $event->getResponse(); -// $this->goToHelper->log( -// PHP_EOL. //$response->getStatusCode() . ' ' . -// print_r($response, true) -// ); + // $response = $event->getResponse(); + // $this->goToHelper->log( + // PHP_EOL. //$response->getStatusCode() . ' ' . + // print_r($response, true) + // ); } /** diff --git a/EventListener/LeadSubscriber.php b/EventListener/LeadSubscriber.php index 4b992df..5fd461c 100644 --- a/EventListener/LeadSubscriber.php +++ b/EventListener/LeadSubscriber.php @@ -18,7 +18,6 @@ use MauticPlugin\LeuchtfeuerGoToBundle\Helper\GoToHelper; use MauticPlugin\LeuchtfeuerGoToBundle\Helper\GoToProductTypes; use MauticPlugin\LeuchtfeuerGoToBundle\Model\GoToModel; -use MauticPlugin\MauticSocialBundle\Entity\Lead; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\EventDispatcher\EventSubscriberInterface; diff --git a/EventListener/PluginEventSubscriber.php b/EventListener/PluginEventSubscriber.php index f0d7e36..d3aef57 100644 --- a/EventListener/PluginEventSubscriber.php +++ b/EventListener/PluginEventSubscriber.php @@ -22,9 +22,6 @@ public function __construct(Connection $connection, LoggerInterface $logger) $this->logger = $logger; } - /** - * {@inheritDoc} - */ public static function getSubscribedEvents(): array { return [ diff --git a/Form/Type/GoToActionType.php b/Form/Type/GoToActionType.php index 26477cd..0887eb7 100644 --- a/Form/Type/GoToActionType.php +++ b/Form/Type/GoToActionType.php @@ -34,8 +34,6 @@ public function __construct( } /** - * {@inheritdoc} - * * @throws ServiceCircularReferenceException * @throws ServiceNotFoundException * @throws ConstraintDefinitionException @@ -44,9 +42,9 @@ public function __construct( */ public function buildForm(FormBuilderInterface $builder, array $options): void { - if (!(array_key_exists('attr', $options) && array_key_exists('data-product', $options['attr'])) || - !GoToProductTypes::isValidValue($options['attr']['data-product']) || - !$this->goToHelper->isAuthorized('Goto'.$options['attr']['data-product']) + if (!(array_key_exists('attr', $options) && array_key_exists('data-product', $options['attr'])) + || !GoToProductTypes::isValidValue($options['attr']['data-product']) + || !$this->goToHelper->isAuthorized('Goto'.$options['attr']['data-product']) ) { return; } @@ -76,9 +74,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $choices[$f['id']] = $f['label']; } - if (array_key_exists('data-product-action', $options['attr']) && - ('register' === $options['attr']['data-product-action'] || - 'start' === $options['attr']['data-product-action']) + if (array_key_exists('data-product-action', $options['attr']) + && ('register' === $options['attr']['data-product-action'] + || 'start' === $options['attr']['data-product-action']) ) { $products = [ 'form' => 'User selection from form', @@ -108,9 +106,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - if (array_key_exists('data-product-action', $options['attr']) && - ('register' === $options['attr']['data-product-action'] || - 'screensharing' === $options['attr']['data-product-action']) + if (array_key_exists('data-product-action', $options['attr']) + && ('register' === $options['attr']['data-product-action'] + || 'screensharing' === $options['attr']['data-product-action']) ) { $builder->add( 'firstname', @@ -196,9 +194,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ] ); - if (array_key_exists('data-product-action', $options['attr']) && - ('start' === $options['attr']['data-product-action'] || - 'screensharing' === $options['attr']['data-product-action']) + if (array_key_exists('data-product-action', $options['attr']) + && ('start' === $options['attr']['data-product-action'] + || 'screensharing' === $options['attr']['data-product-action']) ) { $defaultOptions = [ 'label' => 'plugin.citrix.emailtemplate', diff --git a/Form/Type/GoToCampaignActionType.php b/Form/Type/GoToCampaignActionType.php index b95d5e1..104b6c5 100644 --- a/Form/Type/GoToCampaignActionType.php +++ b/Form/Type/GoToCampaignActionType.php @@ -30,8 +30,6 @@ public function __construct( } /** - * {@inheritdoc} - * * @throws ServiceCircularReferenceException * @throws ServiceNotFoundException * @throws \InvalidArgumentException diff --git a/Form/Type/GoToCampaignEventType.php b/Form/Type/GoToCampaignEventType.php index 1221859..2ff5bea 100644 --- a/Form/Type/GoToCampaignEventType.php +++ b/Form/Type/GoToCampaignEventType.php @@ -30,8 +30,6 @@ public function __construct( } /** - * {@inheritdoc} - * * @throws ServiceCircularReferenceException * @throws ServiceNotFoundException * @throws \InvalidArgumentException diff --git a/Form/Type/GoToListType.php b/Form/Type/GoToListType.php index 2a21942..86a06fe 100644 --- a/Form/Type/GoToListType.php +++ b/Form/Type/GoToListType.php @@ -26,9 +26,6 @@ public function __construct(private GoToModel $citrixModel) { } - /** - * {@inheritdoc} - */ public function buildForm(FormBuilderInterface $builder, array $options): void { $selectMessage = 'Please Select...'; @@ -222,8 +219,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } /** - * {@inheritdoc} - * * @throws AccessException */ public function configureOptions(OptionsResolver $resolver): void diff --git a/Helper/BasicEnum.php b/Helper/BasicEnum.php index 447e8c8..89c0dfa 100644 --- a/Helper/BasicEnum.php +++ b/Helper/BasicEnum.php @@ -44,9 +44,6 @@ public static function isValidName(string $name, bool $strict = false): bool return in_array(strtolower($name), $keys, true); } - /** - * @param mixed $value - */ public static function isValidValue($value, bool $strict = true): bool { $values = array_values(self::getConstants()); diff --git a/Helper/GoToHelper.php b/Helper/GoToHelper.php index db54b37..6117357 100644 --- a/Helper/GoToHelper.php +++ b/Helper/GoToHelper.php @@ -242,12 +242,6 @@ public function getCleanString(string $str, int $limit = 20): string } /** - * @param mixed $productId - * @param mixed $email - * @param mixed $firstname - * @param mixed $lastname - * @param mixed $company - * * @throws BadRequestHttpException */ public function registerToProduct(string $product, $productId, $email, $firstname, $lastname, $company): bool @@ -287,11 +281,6 @@ public function registerToProduct(string $product, $productId, $email, $firstnam } /** - * @param mixed $productId - * @param mixed $email - * @param mixed $firstname - * @param mixed $lastname - * * @throws BadRequestHttpException */ public function startToProduct(string $product, $productId, $email, $firstname, $lastname): bool|string diff --git a/Integration/GoToAbstractIntegration.php b/Integration/GoToAbstractIntegration.php index 634014d..1c01511 100644 --- a/Integration/GoToAbstractIntegration.php +++ b/Integration/GoToAbstractIntegration.php @@ -48,9 +48,6 @@ public function getRefreshTokenKeys(): array ]; } - /** - * {@inheritdoc} - */ public function getAuthenticationType(): string { return 'oauth2'; @@ -68,9 +65,6 @@ public function getRequiredKeyFields(): array ]; } - /** - * {@inheritdoc} - */ public function sortFieldsAlphabetically(): bool { return false; @@ -78,8 +72,6 @@ public function sortFieldsAlphabetically(): bool /** * Get the API helper. - * - * @return mixed */ public function getApiHelper() { @@ -105,25 +97,16 @@ public function getApiUrl(): string return 'https://api.getgo.com'; } - /** - * {@inheritdoc} - */ public function getAccessTokenUrl(): string { return $this->getApiUrl().'/oauth/v2/token'; } - /** - * {@inheritdoc} - */ public function getAuthenticationUrl(): string { return $this->getApiUrl().'/oauth/v2/authorize'; } - /** - * {@inheritdoc} - */ public function isAuthorized(): bool { $keys = $this->getKeys(); diff --git a/LeuchtfeuerGoToBundle.php b/LeuchtfeuerGoToBundle.php index 4d4b2ca..7599f4b 100644 --- a/LeuchtfeuerGoToBundle.php +++ b/LeuchtfeuerGoToBundle.php @@ -11,44 +11,44 @@ */ class LeuchtfeuerGoToBundle extends PluginBundleBase { -// /** -// * Called by PluginController::reloadAction when adding a new plugin that's not already installed. -// * -// * @param null $metadata -// * @param null $installedSchema -// * -// * @throws \Doctrine\DBAL\ConnectionException -// * @throws Exception -// */ -// public static function onPluginInstall(Plugin $plugin, MauticFactory $factory, $metadata = null, $installedSchema = null): void -// { -// $db = $factory->getDatabase(); -// $queries = []; -// -// $queries[] = 'DELETE FROM '.MAUTIC_TABLE_PREFIX.'plugins WHERE bundle = "MauticCitrixBundle"'; -// $queries[] = 'DELETE FROM '.MAUTIC_TABLE_PREFIX.'plugin_integration_settings WHERE name LIKE "goto%"'; -// -// if (!empty($queries)) { -// $db->beginTransaction(); -// try { -// foreach ($queries as $q) { -// $db->query($q); -// } -// -// $db->commit(); -// } catch (Exception $exception) { -// $db->rollback(); -// -// $this->goToHelper->log($exception->getMessage(), LogLevel::NOTICE); -// } -// } -// -// if (null !== $metadata) { -// try { -// self::installPluginSchema($metadata, $factory); -// } catch (TableExistsException $tableExistsException) { -// $this->goToHelper->log($tableExistsException->getMessage(), LogLevel::NOTICE); -// } -// } -// } + // /** + // * Called by PluginController::reloadAction when adding a new plugin that's not already installed. + // * + // * @param null $metadata + // * @param null $installedSchema + // * + // * @throws \Doctrine\DBAL\ConnectionException + // * @throws Exception + // */ + // public static function onPluginInstall(Plugin $plugin, MauticFactory $factory, $metadata = null, $installedSchema = null): void + // { + // $db = $factory->getDatabase(); + // $queries = []; + // + // $queries[] = 'DELETE FROM '.MAUTIC_TABLE_PREFIX.'plugins WHERE bundle = "MauticCitrixBundle"'; + // $queries[] = 'DELETE FROM '.MAUTIC_TABLE_PREFIX.'plugin_integration_settings WHERE name LIKE "goto%"'; + // + // if (!empty($queries)) { + // $db->beginTransaction(); + // try { + // foreach ($queries as $q) { + // $db->query($q); + // } + // + // $db->commit(); + // } catch (Exception $exception) { + // $db->rollback(); + // + // $this->goToHelper->log($exception->getMessage(), LogLevel::NOTICE); + // } + // } + // + // if (null !== $metadata) { + // try { + // self::installPluginSchema($metadata, $factory); + // } catch (TableExistsException $tableExistsException) { + // $this->goToHelper->log($tableExistsException->getMessage(), LogLevel::NOTICE); + // } + // } + // } } diff --git a/Model/GoToModel.php b/Model/GoToModel.php index 8a78056..6e49e0c 100644 --- a/Model/GoToModel.php +++ b/Model/GoToModel.php @@ -58,8 +58,6 @@ public function __construct( } /** - * {@inheritdoc} - * * @return \MauticPlugin\LeuchtfeuerGoToBundle\Entity\GoToEventRepository */ public function getRepository() @@ -74,7 +72,7 @@ public function getRepository() * @throws ServiceCircularReferenceException * @throws ServiceNotFoundException */ - public function addEvent(string $product, string $email, string $eventName, string $eventDesc, string $eventType, Lead $lead, \DateTime $eventDate = null): void + public function addEvent(string $product, string $email, string $eventName, string $eventDesc, string $eventType, Lead $lead, ?\DateTime $eventDate = null): void { if (!GoToProductTypes::isValidValue($product) || !GoToEventTypes::isValidValue($eventType)) { $this->goToHelper->log('addEvent: incorrect data'); @@ -239,7 +237,7 @@ public function countEventsBy(string $product, string $email, string $eventType, return (int) $query->getResult()[0]['cant']; } - public function syncEvent(string $product, string $productId, string $eventName, string $eventDesc, int &$count = 0, OutputInterface $output = null): void + public function syncEvent(string $product, string $productId, string $eventName, string $eventDesc, int &$count = 0, ?OutputInterface $output = null): void { $cpr = $this->getProductRepository(); /** @var GoToProduct $product_result */ @@ -301,7 +299,7 @@ public function batchAddAndRemove( string $eventType, array $contactsToAdd = [], array $emailsToRemove = [], - OutputInterface $output = null + ?OutputInterface $output = null ): int { if (!GoToProductTypes::isValidValue($product) || !GoToEventTypes::isValidValue($eventType)) { return 0; @@ -415,7 +413,7 @@ private function filterEventContacts(mixed $found, mixed $known): array /** * @param mixed[] $product */ - public function syncProduct(string $productType, array $product, OutputInterface $output = null): void + public function syncProduct(string $productType, array $product, ?OutputInterface $output = null): void { /** @var GoToProductRepository $productRepository */ $productRepository = $this->getProductRepository(); @@ -472,7 +470,7 @@ public function syncProduct(string $productType, array $product, OutputInterface /** * @return mixed[] */ - public function getProducts(string $product_name, \DateTime $from = null, \DateTime $to = null, bool $reduceSessions = false, bool $withDetails = null): array + public function getProducts(string $product_name, ?\DateTime $from = null, ?\DateTime $to = null, bool $reduceSessions = false, ?bool $withDetails = null): array { $cpr = $this->getProductRepository(); $products = $cpr->getCitrixChoices(true, $reduceSessions); @@ -491,7 +489,7 @@ public function getProducts(string $product_name, \DateTime $from = null, \DateT return $products; } - public function getIdByNameAndDate(string $name, string $date): int|null + public function getIdByNameAndDate(string $name, string $date): ?int { $productRepository = $this->getProductRepository(); $result = $productRepository->findOneBy(['name' => $name, 'date' => $date]); diff --git a/Tests/DataFixtures/ORM/LoadCitrixData.php b/Tests/DataFixtures/ORM/LoadCitrixData.php index 433a4b9..9038a51 100644 --- a/Tests/DataFixtures/ORM/LoadCitrixData.php +++ b/Tests/DataFixtures/ORM/LoadCitrixData.php @@ -20,7 +20,7 @@ class LoadCitrixData extends AbstractFixture implements OrderedFixtureInterface, { private ContainerInterface $container; - public function setContainer(ContainerInterface $container = null): void + public function setContainer(?ContainerInterface $container = null): void { $this->container = $container; } From bce3f4f272ff243fe3f519ff445f32ccad0564c8 Mon Sep 17 00:00:00 2001 From: Patrick Jenkner Date: Wed, 14 Aug 2024 14:35:04 +0200 Subject: [PATCH 4/5] only run cs fixer for now --- .github/workflows/ci.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5a30517..c37357e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,15 +23,4 @@ jobs: - name: Install composer requirements. run: composer install - name: Check PHP CS - run: ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --dry-run --using-cache no --show-progress dots -v - - name: Run PHPUnit - run: ./vendor/bin/phpunit --testsuite unit --coverage-cobertura=coverage.xml - - name: Code Coverage - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: coverage.xml - badge: true - format: 'markdown' - output: 'both' - - name: Write to Job Summary - run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY \ No newline at end of file + run: ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --dry-run --using-cache no --show-progress dots -v \ No newline at end of file From 06bbdfbe96b41fc45914a9a5dd4a420856e3a51f Mon Sep 17 00:00:00 2001 From: Patrick Jenkner <139468697+PatrickJenkner@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:09:21 +0200 Subject: [PATCH 5/5] add further cs findings --- Integration/GoToAbstractIntegration.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Integration/GoToAbstractIntegration.php b/Integration/GoToAbstractIntegration.php index 8fb2b5b..a71c799 100644 --- a/Integration/GoToAbstractIntegration.php +++ b/Integration/GoToAbstractIntegration.php @@ -97,16 +97,11 @@ public function getApiUrl(): string return 'https://api.getgo.com'; } - public function getAuthBaseUrl(): string { return 'https://authentication.logmeininc.com'; } - /** - * {@inheritdoc} - */ - public function getAccessTokenUrl(): string { return $this->getAuthBaseUrl().'/oauth/token';