<commit_before><?php

/*
 * This file is part of the Symfony package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bundle\FrameworkBundle\Test;

use PHPUnit\Framework\Constraint\LogicalNot;
use Symfony\Component\Notifier\Event\MessageEvent;
use Symfony\Component\Notifier\Event\NotificationEvents;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Test\Constraint as NotifierConstraint;

/*
 * @author <NAME> <<EMAIL>>
 */
trait NotificationAssertionsTrait
{
    public static function assertNotificationCount(int $count, string $transport = null, string $message = ''): void
    {
        self::assertThat(self::getNotificationEvents(), new NotifierConstraint\NotificationCount($count, $transport), $message);
    }

    public static function assertQueuedNotificationCount(int $count, string $transport = null, string $message = ''): void
    {
        self::assertThat(self::getMessageMailerEvents(), new NotifierConstraint\NotificationCount($count, $transport, true), $message);
    }

    public static function assertNotificationIsQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($event, new NotifierConstraint\NotificationIsQueued(), $message);
    }

    public static function assertNotificationIsNotQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($event, new LogicalNot(new NotifierConstraint\NotificationIsQueued()), $message);
    }

    public static function assertNotificationSubjectContains(MessageInterface $messageObject, string $text, string $message = ''): void
    {
        self::assertThat($messageObject, new NotifierConstraint\NotificationSubjectContains($text), $message);
    }

    public static function assertNotificationSubjectNotContains(MessageInterface $messageObject, string $text, string $message = ''): void
    {
        self::assertThat($messageObject, new LogicalNot(new NotifierConstraint\NotificationSubjectContains($text)), $message);
    }

    public static function assertNotificationTransportIsEqual(MessageInterface $messageObject, string $text, string $message = ''): void
    {
        self::assertThat($messageObject, new NotifierConstraint\NotificationTransportIsEqual($text), $message);
    }

    public static function assertNotificationTransportIsNotEqual(MessageInterface $messageObject, string $text, string $message = ''): void
    {
        self::assertThat($messageObject, new LogicalNot(new NotifierConstraint\NotificationTransportIsEqual($text)), $message);
    }

    /**
     * @return MessageEvent[]
     */
    public static function getNotifierEvents(string $transport = null): array
    {
        return self::getNotificationEvents()->getEvents($transport);
    }

    public static function getNotifierEvent(int $index = 0, string $transport = null): ?MessageEvent
    {
        return self::getNotifierEvents($transport)[$index] ?? null;
    }

    /**
     * @return MessageInterface[]
     */
    public static function getNotifierMessages(string $transport = null): array
    {
        return self::getNotificationEvents()->getMessages($transport);
    }

    public static function getNotifierMessage(int $index = 0, string $transport = null): ?MessageInterface
    {
        return self::getNotifierMessages($transport)[$index] ?? null;
    }

    public static function getNotificationEvents(): NotificationEvents
    {
        $container = static::getContainer();
        if ($container->has('notifier.logger_notification_listener')) {
            return $container->get('notifier.logger_notification_listener')->getEvents();
        }

        static::fail('A client must have Notifier enabled to make notifications assertions. Did you forget to require symfony/notifier?');
    }
}<commit_msg>[Notifier] Rename some arguments in notifier assertions<commit_after><?php

/*
 * This file is part of the Symfony package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bundle\FrameworkBundle\Test;

use PHPUnit\Framework\Constraint\LogicalNot;
use Symfony\Component\Notifier\Event\MessageEvent;
use Symfony\Component\Notifier\Event\NotificationEvents;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Test\Constraint as NotifierConstraint;

/*
 * @author <NAME> <<EMAIL>>
 */
trait NotificationAssertionsTrait
{
    public static function assertNotificationCount(int $count, string $transportName = null, string $message = ''): void
    {
        self::assertThat(self::getNotificationEvents(), new NotifierConstraint\NotificationCount($count, $transportName), $message);
    }

    public static function assertQueuedNotificationCount(int $count, string $transportName = null, string $message = ''): void
    {
        self::assertThat(self::getMessageMailerEvents(), new NotifierConstraint\NotificationCount($count, $transportName, true), $message);
    }

    public static function assertNotificationIsQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($event, new NotifierConstraint\NotificationIsQueued(), $message);
    }

    public static function assertNotificationIsNotQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($event, new LogicalNot(new NotifierConstraint\NotificationIsQueued()), $message);
    }

    public static function assertNotificationSubjectContains(MessageInterface $notification, string $text, string $message = ''): void
    {
        self::assertThat($notification, new NotifierConstraint\NotificationSubjectContains($text), $message);
    }

    public static function assertNotificationSubjectNotContains(MessageInterface $notification, string $text, string $message = ''): void
    {
        self::assertThat($notification, new LogicalNot(new NotifierConstraint\NotificationSubjectContains($text)), $message);
    }

    public static function assertNotificationTransportIsEqual(MessageInterface $notification, string $transportName, string $message = ''): void
    {
        self::assertThat($notification, new NotifierConstraint\NotificationTransportIsEqual($transportName), $message);
    }

    public static function assertNotificationTransportIsNotEqual(MessageInterface $notification, string $transportName, string $message = ''): void
    {
        self::assertThat($notification, new LogicalNot(new NotifierConstraint\NotificationTransportIsEqual($transportName)), $message);
    }

    /**
     * @return MessageEvent[]
     */
    public static function getNotifierEvents(string $transportName = null): array
    {
        return self::getNotificationEvents()->getEvents($transportName);
    }

    public static function getNotifierEvent(int $index = 0, string $transportName = null): ?MessageEvent
    {
        return self::getNotifierEvents($transportName)[$index] ?? null;
    }

    /**
     * @return MessageInterface[]
     */
    public static function getNotifierMessages(string $transportName = null): array
    {
        return self::getNotificationEvents()->getMessages($transportName);
    }

    public static function getNotifierMessage(int $index = 0, string $transportName = null): ?MessageInterface
    {
        return self::getNotifierMessages($transportName)[$index] ?? null;
    }

    public static function getNotificationEvents(): NotificationEvents
    {
        $container = static::getContainer();
        if ($container->has('notifier.logger_notification_listener')) {
            return $container->get('notifier.logger_notification_listener')->getEvents();
        }

        static::fail('A client must have Notifier enabled to make notifications assertions. Did you forget to require symfony/notifier?');
    }
}
{'fraction_non_alphanumeric': 0.10873932697137118, 'fraction_numerical': 0.0005022601707684581, 'mean_word_length': 4.558269364968598, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '419943', 'n_tokens_mistral': 1981, 'n_tokens_neox': 1941, 'n_words': 488}