Bravo3\Orm\Tests\EntityManagerTest::testIo PHP Метод

testIo() публичный Метод

public testIo ( EntityManager $em )
$em Bravo3\Orm\Services\EntityManager
    public function testIo(EntityManager $em)
    {
        $create_time = new \DateTime("2015-01-01 12:15:03+0000");
        $product = new Product();
        $product->setId(123)->setName('Test Product')->setDescription("lorem ipsum")->setActive(true)->setCreateTime($create_time)->setPrice(12.45);
        $em->persist($product);
        $em->flush();
        /** @var Product|OrmProxyInterface $retrieved */
        $retrieved = $em->retrieve(Product::class, 123);
        $this->validateProxyInterface($retrieved);
        $this->assertEquals($product->getId(), $retrieved->getId());
        $this->assertEquals($product->getName(), $retrieved->getName());
        $this->assertEquals($product->getDescription(), $retrieved->getDescription());
        $this->assertEquals('01/01/2015 12:15:03', $retrieved->getCreateTime()->format('d/m/Y H:i:s'));
        $this->assertSame(12.45, $retrieved->getPrice());
        $this->assertTrue($retrieved->getActive());
    }