<commit_before><?php
namespace Neos\Flow\Tests\Unit\Persistence\Generic;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

require_once(__DIR__ . '/../Fixture/Model/Entity2.php');
require_once(__DIR__ . '/../Fixture/Model/Entity3.php');
require_once(__DIR__ . '/../Fixture/Model/DirtyEntity.php');
require_once(__DIR__ . '/../Fixture/Model/CleanEntity.php');

use Neos\Flow\Persistence\Aspect\PersistenceMagicInterface;
use Neos\Flow\Persistence\Generic;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Tests\Persistence\Fixture;

/**
 * Testcase for the Persistence Manager
 */
class PersistenceManagerTest extends UnitTestCase
{
    /**
     * @test
     */
    public function initializeInitializesBackendWithBackendOptions()
    {
        $mockBackend = $this->createMock(Generic\Backend\BackendInterface::class);
        $mockBackend->expects($this->once())->method('initialize')->with(['Foo' => 'Bar']);

        $manager = new Generic\PersistenceManager();
        $manager->injectBackend($mockBackend);

        $manager->injectSettings(['persistence' => ['backendOptions' => ['Foo' => 'Bar']]]);
        $manager->initialize();
    }

    /**
     * @test
     */
    public function persistAllPassesAddedObjectsToBackend()
    {
        $entity2 = new Fixture\Model\Entity2();
        $objectStorage = new \SplObjectStorage();
        $objectStorage->attach($entity2);
        $mockBackend = $this->createMock(Generic\Backend\BackendInterface::class);
        $mockBackend->expects($this->once())->method('setAggregateRootObjects')->with($objectStorage);

        $manager = new Generic\PersistenceManager();<commit_msg>TASK: Remove test for initialize that was removed<commit_after><?php
namespace Neos\Flow\Tests\Unit\Persistence\Generic;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

require_once(__DIR__ . '/../Fixture/Model/Entity2.php');
require_once(__DIR__ . '/../Fixture/Model/Entity3.php');
require_once(__DIR__ . '/../Fixture/Model/DirtyEntity.php');
require_once(__DIR__ . '/../Fixture/Model/CleanEntity.php');

use Neos\Flow\Persistence\Aspect\PersistenceMagicInterface;
use Neos\Flow\Persistence\Generic;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Flow\Tests\Persistence\Fixture;

/**
 * Testcase for the Persistence Manager
 */
class PersistenceManagerTest extends UnitTestCase
{
    /**
     * @test
     */
    public function persistAllPassesAddedObjectsToBackend()
    {
        $entity2 = new Fixture\Model\Entity2();
        $objectStorage = new \SplObjectStorage();
        $objectStorage->attach($entity2);
        $mockBackend = $this->createMock(Generic\Backend\BackendInterface::class);
        $mockBackend->expects($this->once())->method('setAggregateRootObjects')->with($objectStorage);

        $manager = new Generic\PersistenceManager();
{'fraction_non_alphanumeric': 0.1401782969566554, 'fraction_numerical': 0.003074085459575776, 'mean_word_length': 3.87125748502994, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2139206', 'n_tokens_mistral': 936, 'n_tokens_neox': 945, 'n_words': 193}