forked from doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnComparisonEventArgsTest.php
44 lines (35 loc) · 1.48 KB
/
OnComparisonEventArgsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Doctrine\Tests\ORM\Event;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\OnComparisonEventArgs;
use Doctrine\Tests\Models\Quote\City;
use PHPUnit\Framework\TestCase;
/**
* Tests for {@see \Doctrine\ORM\Event\OnComparisonEventArgsTest}
*
* @covers \Doctrine\ORM\Event\OnComparisonEventArgsTest
*/
class OnComparisonEventArgsTest extends TestCase
{
public function testOnComparisonEventArgs()
{
/* @var $objectManager \Doctrine\Common\Persistence\ObjectManager */
$objectManager = $this->createMock(EntityManagerInterface::class);
$entity = new City('foo');
$args = new OnComparisonEventArgs($objectManager, $entity, 'name', $entity->name, 'bar');
$this->assertInstanceOf(LifecycleEventArgs::class, $args);
$this->assertSame('foo', $args->getOriginalValue());
$this->assertSame('bar', $args->getActualValue());
$this->assertSame('name', $args->getPropertyName());
$this->assertSame($objectManager, $args->getObjectManager());
$this->assertSame($entity, $args->getObject());
$this->assertNull($args->getComparisonResult());
$args->setComparisonResult(-1);
$this->assertSame(-1, $args->getComparisonResult());
$args->setComparisonResult(0);
$this->assertSame(0, $args->getComparisonResult());
$args->setComparisonResult(1);
$this->assertSame(1, $args->getComparisonResult());
}
}