<commit_before><?php

namespace Doctrine\ODM\MongoDB\Tests\Functional\Ticket;

use Doctrine\MongoDB\GridFSFile;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

class GH832Test extends \Doctrine\ODM\MongoDB\Tests\BaseTest
{
    /**
     * @expectedException MongoGridFSException
     */
    public function testGridFSWithUniqueIndex()
    {
        $this->dm->getSchemaManager()->ensureDocumentIndexes(GH832Document::CLASS);

        $docA = new GH832Document();
        $docA->unique = 'foo';
        $docA->file = new GridFSFile(__FILE__);

        $this->dm->persist($docA);
        $this->dm->flush();
        $this->dm->clear();

        $docB = new GH832Document();
        $docB->unique = 'foo';<commit_msg>Fix test for PHP 5.4<commit_after><?php

namespace Doctrine\ODM\MongoDB\Tests\Functional\Ticket;

use Doctrine\MongoDB\GridFSFile;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

class GH832Test extends \Doctrine\ODM\MongoDB\Tests\BaseTest
{
    /**
     * @expectedException MongoGridFSException
     */
    public function testGridFSWithUniqueIndex()
    {
        $doc = new GH832Document();
        $this->dm->getSchemaManager()->ensureDocumentIndexes(get_class($doc));

        $docA = new GH832Document();
        $docA->unique = 'foo';
        $docA->file = new GridFSFile(__FILE__);

        $this->dm->persist($docA);
        $this->dm->flush();
        $this->dm->clear();

        $docB = new GH832Document();
        $docB->unique = 'foo';
{'fraction_non_alphanumeric': 0.1470189701897019, 'fraction_numerical': 0.017615176151761516, 'mean_word_length': 3.0355191256830603, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2014540', 'n_tokens_mistral': 510, 'n_tokens_neox': 480, 'n_words': 76}