Skip to content

Instantly share code, notes, and snippets.

@alcaeus
Created June 4, 2019 15:40
Show Gist options
  • Save alcaeus/30592b53acbd96d35d57391c515807bd to your computer and use it in GitHub Desktop.
Save alcaeus/30592b53acbd96d35d57391c515807bd to your computer and use it in GitHub Desktop.
Functional test for #2028
<?php
namespace Doctrine\ODM\MongoDB\Tests\Functional\Ticket;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\ODM\MongoDB\Tests\BaseTest;
class GH2028Test extends BaseTest
{
public function testStoreHashWithIntKeys()
{
$document = new GH2028Document();
$document->hash = [
'foo' => 'bar',
123 => 'baz',
'456' => 'foo',
];
$this->dm->persist($document);
$this->dm->flush();
$this->dm->clear();
$document = $this->dm->find(GH2028Document::class, $document->id);
self::assertSame([
'foo' => 'bar',
123 => 'baz',
'456' => 'foo',
], $document->hash);
}
}
/** @ODM\Document */
class GH2028Document
{
/** @ODM\Id */
public $id;
/** @ODM\Field(type="hash") */
public $hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment