mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 19:51:30 +00:00
Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to address issues observed during initial testing. These files have been updated in order to generate a new set of app images.
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Mailer\Test\Constraint;
|
||||
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use Symfony\Component\Mailer\Event\MessageEvents;
|
||||
|
||||
final class EmailCount extends Constraint
|
||||
{
|
||||
private int $expectedValue;
|
||||
private ?string $transport;
|
||||
private bool $queued;
|
||||
|
||||
public function __construct(int $expectedValue, ?string $transport = null, bool $queued = false)
|
||||
{
|
||||
$this->expectedValue = $expectedValue;
|
||||
$this->transport = $transport;
|
||||
$this->queued = $queued;
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
return sprintf('%shas %s "%d" emails', $this->transport ? $this->transport.' ' : '', $this->queued ? 'queued' : 'sent', $this->expectedValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MessageEvents $events
|
||||
*/
|
||||
protected function matches($events): bool
|
||||
{
|
||||
return $this->expectedValue === $this->countEmails($events);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MessageEvents $events
|
||||
*/
|
||||
protected function failureDescription($events): string
|
||||
{
|
||||
return sprintf('the Transport %s (%d %s)', $this->toString(), $this->countEmails($events), $this->queued ? 'queued' : 'sent');
|
||||
}
|
||||
|
||||
private function countEmails(MessageEvents $events): int
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($events->getEvents($this->transport) as $event) {
|
||||
if (
|
||||
($this->queued && $event->isQueued())
|
||||
|| (!$this->queued && !$event->isQueued())
|
||||
) {
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Mailer\Test\Constraint;
|
||||
|
||||
use PHPUnit\Framework\Constraint\Constraint;
|
||||
use Symfony\Component\Mailer\Event\MessageEvent;
|
||||
|
||||
final class EmailIsQueued extends Constraint
|
||||
{
|
||||
public function toString(): string
|
||||
{
|
||||
return 'is queued';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MessageEvent $event
|
||||
*/
|
||||
protected function matches($event): bool
|
||||
{
|
||||
return $event->isQueued();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MessageEvent $event
|
||||
*/
|
||||
protected function failureDescription($event): string
|
||||
{
|
||||
return 'the Email '.$this->toString();
|
||||
}
|
||||
}
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Mailer\Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Mailer\Exception\IncompleteDsnException;
|
||||
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
|
||||
use Symfony\Component\Mailer\Transport\Dsn;
|
||||
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;
|
||||
use Symfony\Component\Mailer\Transport\TransportInterface;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
/**
|
||||
* A test case to ease testing Transport Factory.
|
||||
*
|
||||
* @author Konstantin Myakshin <molodchick@gmail.com>
|
||||
*/
|
||||
abstract class TransportFactoryTestCase extends TestCase
|
||||
{
|
||||
protected const USER = 'u$er';
|
||||
protected const PASSWORD = 'pa$s';
|
||||
|
||||
protected $dispatcher;
|
||||
protected $client;
|
||||
protected $logger;
|
||||
|
||||
abstract public function getFactory(): TransportFactoryInterface;
|
||||
|
||||
abstract public static function supportsProvider(): iterable;
|
||||
|
||||
abstract public static function createProvider(): iterable;
|
||||
|
||||
public static function unsupportedSchemeProvider(): iterable
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function incompleteDsnProvider(): iterable
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider supportsProvider
|
||||
*/
|
||||
public function testSupports(Dsn $dsn, bool $supports)
|
||||
{
|
||||
$factory = $this->getFactory();
|
||||
|
||||
$this->assertSame($supports, $factory->supports($dsn));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider createProvider
|
||||
*/
|
||||
public function testCreate(Dsn $dsn, TransportInterface $transport)
|
||||
{
|
||||
$factory = $this->getFactory();
|
||||
|
||||
$this->assertEquals($transport, $factory->create($dsn));
|
||||
if (str_contains('smtp', $dsn->getScheme())) {
|
||||
$this->assertStringMatchesFormat($dsn->getScheme().'://%S'.$dsn->getHost().'%S', (string) $transport);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider unsupportedSchemeProvider
|
||||
*/
|
||||
public function testUnsupportedSchemeException(Dsn $dsn, ?string $message = null)
|
||||
{
|
||||
$factory = $this->getFactory();
|
||||
|
||||
$this->expectException(UnsupportedSchemeException::class);
|
||||
if (null !== $message) {
|
||||
$this->expectExceptionMessage($message);
|
||||
}
|
||||
|
||||
$factory->create($dsn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider incompleteDsnProvider
|
||||
*/
|
||||
public function testIncompleteDsnException(Dsn $dsn)
|
||||
{
|
||||
$factory = $this->getFactory();
|
||||
|
||||
$this->expectException(IncompleteDsnException::class);
|
||||
$factory->create($dsn);
|
||||
}
|
||||
|
||||
protected function getDispatcher(): EventDispatcherInterface
|
||||
{
|
||||
return $this->dispatcher ??= $this->createMock(EventDispatcherInterface::class);
|
||||
}
|
||||
|
||||
protected function getClient(): HttpClientInterface
|
||||
{
|
||||
return $this->client ??= $this->createMock(HttpClientInterface::class);
|
||||
}
|
||||
|
||||
protected function getLogger(): LoggerInterface
|
||||
{
|
||||
return $this->logger ??= $this->createMock(LoggerInterface::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user