Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Aug 30, 2024
1 parent df704fc commit 35054d9
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 9 deletions.
11 changes: 6 additions & 5 deletions dist/src/Entity/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

#[ORM\Entity()]
#[ORM\Table(name: 'sylius_channel')]
#[ORM\AssociationOverrides([
new ORM\AssociationOverride(
name: 'baseCurrency',
joinColumns: new ORM\JoinColumn(name: 'base_currency_id', referencedColumnName: 'id', nullable: true)
)]
#[ORM\AssociationOverrides(
[
new ORM\AssociationOverride(
name: 'baseCurrency',
joinColumns: new ORM\JoinColumn(name: 'base_currency_id', referencedColumnName: 'id', nullable: true)
)]
)]
/**
* @ORM\Entity
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ parameters:
- 'tests/Application/**/*'

ignoreErrors:
- identifier: missingType.generics
- identifier: missingType.iterableValue
55 changes: 55 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.0/phpunit.xsd"
colors="true"
bootstrap="tests/Application/config/bootstrap.php">
<testsuites>
<testsuite name="MonsieurBizSyliusNoCommercePlugin Test Suite">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>

<php>
<server name="KERNEL_CLASS_PATH" value="/tests/Application/src/Kernel.php" />
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" />

<env name="APP_ENV" value="test"/>
<env name="SHELL_VERBOSITY" value="-1" />

<!-- &lt;!&ndash; ###+ symfony/framework-bundle ### &ndash;&gt;-->
<!-- <env name="APP_ENV" value="dev"/>-->
<!-- <env name="APP_SECRET" value="69d8e0f7d4a5fb559fe358f0ae529ad1"/>-->
<!-- &lt;!&ndash; env name="TRUSTED_PROXIES" value="127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16" &ndash;&gt;-->
<!-- &lt;!&ndash; env name="TRUSTED_HOSTS" value="'^(localhost|example\.com)$'" &ndash;&gt;-->
<!-- &lt;!&ndash; ###- symfony/framework-bundle ### &ndash;&gt;-->

<!-- &lt;!&ndash; ###+ symfony/swiftmailer-bundle ### &ndash;&gt;-->
<!-- &lt;!&ndash; For Gmail as a transport, use: "gmail://username:password@localhost" &ndash;&gt;-->
<!-- &lt;!&ndash; For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" &ndash;&gt;-->
<!-- &lt;!&ndash; Delivery is disabled by default via "null://localhost" &ndash;&gt;-->
<!-- <env name="MAILER_URL" value="null://localhost"/>-->
<!-- &lt;!&ndash; ###- symfony/swiftmailer-bundle ### &ndash;&gt;-->

<!-- &lt;!&ndash; ###+ symfony/messenger ### &ndash;&gt;-->
<!-- &lt;!&ndash; Choose one of the transports below &ndash;&gt;-->
<!-- &lt;!&ndash; MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages &ndash;&gt;-->
<!-- &lt;!&ndash; MESSENGER_TRANSPORT_DSN=doctrine://default &ndash;&gt;-->
<!-- &lt;!&ndash; MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages &ndash;&gt;-->
<!-- &lt;!&ndash; ###- symfony/messenger ### &ndash;&gt;-->

<!-- &lt;!&ndash; ###+ doctrine/doctrine-bundle ### &ndash;&gt;-->
<!-- &lt;!&ndash; Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url &ndash;&gt;-->
<!-- &lt;!&ndash; For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" &ndash;&gt;-->
<!-- &lt;!&ndash; For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8" &ndash;&gt;-->
<!-- &lt;!&ndash; IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml &ndash;&gt;-->
<!-- <env name="DATABASE_URL" value="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7"/>-->
<!-- &lt;!&ndash; ###- doctrine/doctrine-bundle ### &ndash;&gt;-->

<!-- &lt;!&ndash; ###+ lexik/jwt-authentication-bundle ### &ndash;&gt;-->
<!-- <env name="JWT_SECRET_KEY" value="%kernel.project_dir%/config/jwt/private.pem"/>-->
<!-- <env name="JWT_PUBLIC_KEY" value="%kernel.project_dir%/config/jwt/public.pem"/>-->
<!-- <env name="JWT_PASSPHRASE" value="8d17d1cb8344b23ee4645e6d6aec8d3b"/>-->
<!-- &lt;!&ndash; ###- lexik/jwt-authentication-bundle ### &ndash;&gt;-->
</php>
</phpunit>
6 changes: 5 additions & 1 deletion src/DependencyInjection/FirewallRegistryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Reference;

final class FirewallRegistryPass implements CompilerPassInterface
{
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function process(ContainerBuilder $container): void
{
$registry = $container->findDefinition('MonsieurBiz\SyliusNoCommercePlugin\Firewall\RegistryInterface');
Expand All @@ -30,6 +33,7 @@ public function process(ContainerBuilder $container): void
if (!$configuration instanceof ChildDefinition) {
continue;
}

try {
$parent = $container->getDefinition($configuration->getParent());
} catch (ServiceNotFoundException $e) {
Expand Down
3 changes: 3 additions & 0 deletions src/Form/Type/Settings/NoCommerceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$choices = [];
foreach ($this->firewallRegistry as $firewall) {
$firewallConfig = $firewall->getConfig();
if (null === $firewallConfig) {
continue;
}
$firewallName = $firewallConfig->getName();
if (\in_array($firewallName, self::FIREWALLS_NAMES_CANNOT_BE_DISABLED, true)) {
continue;
Expand Down
1 change: 0 additions & 1 deletion src/Registry/TemplateBlockRegistryDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public function findEnabledForEvents(array $eventNames): array
$templateBlocksPriorityQueue->insert($templateBlock, $templateBlock->getPriority());
}

/** @phpstan-ignore-next-line */
return $templateBlocksPriorityQueue->toArray();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Routing/NoCommerceRequestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public function __call(string $name, array $arguments)
return \call_user_func($callback, ...$arguments);
}

throw new Exception(sprintf('Method %s not found for class "%s"', $name, \get_class($this->decorated)));
throw new Exception(\sprintf('Method %s not found for class "%s"', $name, \get_class($this->decorated)));
}
}
Empty file added tests/Unit/.gitkeep
Empty file.

0 comments on commit 35054d9

Please sign in to comment.