File: DoctrineProxyFilterTest.php

package info (click to toggle)
php-deepcopy 1.13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 612 kB
  • sloc: php: 1,793; makefile: 26
file content (40 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (4)
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
<?php declare(strict_types=1);

namespace DeepCopyTest\Filter\Doctrine;

use BadMethodCallException;
use DeepCopy\Filter\Doctrine\DoctrineProxyFilter;
use PHPUnit\Framework\TestCase;

/**
 * @covers \DeepCopy\Filter\Doctrine\DoctrineProxyFilter
 */
class DoctrineProxyFilterTest extends TestCase
{
    public function test_it_loads_the_doctrine_proxy()
    {
        $foo = new Foo();

        $filter = new DoctrineProxyFilter();

        $filter->apply(
            $foo,
            'unknown',
            function($item) {
                throw new BadMethodCallException('Did not expect to be called.');
            }
        );

        $this->assertTrue($foo->isLoaded);
    }
}

class Foo
{
    public $isLoaded = false;

    public function __load()
    {
        $this->isLoaded = true;
    }
}