<commit_before><?php

namespace Oro\Bundle\TestFrameworkBundle\Behat\Listener;

use Behat\Behat\EventDispatcher\Event\AfterFeatureTested;
use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested;
use Behat\Behat\EventDispatcher\Event\FeatureTested;
use Oro\Bundle\TestFrameworkBundle\Behat\Dumper\DbDumperInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DbRestoreSubscriber implements EventSubscriberInterface
{
    const ANNOTATION = 'dbIsolation';

    /** @var  DbDumperInterface  */
    protected $dbDumper;

    /**
     * @param DbDumperInterface $dbDumper
     */
    public function __construct(DbDumperInterface $dbDumper)
    {
        $this->dbDumper = $dbDumper;
    }

    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            FeatureTested::AFTER  => ['dbRestore', 5],
        ];
    }

    public function dbDump(BeforeFeatureTested $event)
    {
        if (!in_array(self::ANNOTATION, $event->getFeature()->getTags())) {
            return;
        }

        $this->dbDumper->dumpDb();
    }

    public function dbRestore(AfterFeatureTested $event)
    {
        if (!in_array(self::ANNOTATION, $event->getFeature()->getTags())) {
            return;
        }

        $this->dbDumper->restoreDb();
    }
}<commit_msg>BAP-10324: Removed unused dbDump method from DbRestoreSubscriber<commit_after><?php

namespace Oro\Bundle\TestFrameworkBundle\Behat\Listener;

use Behat\Behat\EventDispatcher\Event\AfterFeatureTested;
use Behat\Behat\EventDispatcher\Event\FeatureTested;
use Oro\Bundle\TestFrameworkBundle\Behat\Dumper\DbDumperInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DbRestoreSubscriber implements EventSubscriberInterface
{
    const ANNOTATION = 'dbIsolation';

    /** @var  DbDumperInterface  */
    protected $dbDumper;

    /**
     * @param DbDumperInterface $dbDumper
     */
    public function __construct(DbDumperInterface $dbDumper)
    {
        $this->dbDumper = $dbDumper;
    }

    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            FeatureTested::AFTER  => ['dbRestore', 5],
        ];
    }

    /**
     * @param AfterFeatureTested $event
     */
    public function dbRestore(AfterFeatureTested $event)
    {
        if (!in_array(self::ANNOTATION, $event->getFeature()->getTags())) {
            return;
        }

        $this->dbDumper->restoreDb();
    }
}
{'fraction_non_alphanumeric': 0.11642743221690591, 'fraction_numerical': 0.0027910685805422647, 'mean_word_length': 3.0144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '420563', 'n_tokens_mistral': 789, 'n_tokens_neox': 758, 'n_words': 118}