1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DoctrineORMModuleTest\Options; |
4
|
|
|
|
5
|
|
|
use PHPUnit\Framework\TestCase; |
6
|
|
|
use DoctrineORMModule\Options\Configuration; |
7
|
|
|
use Doctrine\ORM\Repository\DefaultRepositoryFactory; |
8
|
|
|
|
9
|
|
|
class ConfigurationOptionsTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
public function testSetGetNamingStrategy() |
12
|
|
|
{ |
13
|
|
|
$options = new Configuration(); |
14
|
|
|
$options->setNamingStrategy(null); |
15
|
|
|
$this->assertNull($options->getNamingStrategy()); |
|
|
|
|
16
|
|
|
|
17
|
|
|
$options->setNamingStrategy('test'); |
18
|
|
|
$this->assertSame('test', $options->getNamingStrategy()); |
|
|
|
|
19
|
|
|
|
20
|
|
|
$namingStrategy = $this->createMock(\Doctrine\ORM\Mapping\NamingStrategy::class); |
|
|
|
|
21
|
|
|
$options->setNamingStrategy($namingStrategy); |
22
|
|
|
$this->assertSame($namingStrategy, $options->getNamingStrategy()); |
|
|
|
|
23
|
|
|
|
24
|
|
|
$this->expectException(\Laminas\Stdlib\Exception\InvalidArgumentException::class); |
|
|
|
|
25
|
|
|
$options->setNamingStrategy(new \stdClass()); |
|
|
|
|
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function testSetGetQuoteStrategy() |
29
|
|
|
{ |
30
|
|
|
$options = new Configuration(); |
31
|
|
|
$options->setQuoteStrategy(null); |
32
|
|
|
$this->assertNull($options->getQuoteStrategy()); |
|
|
|
|
33
|
|
|
|
34
|
|
|
$options->setQuoteStrategy('test'); |
35
|
|
|
$this->assertSame('test', $options->getQuoteStrategy()); |
|
|
|
|
36
|
|
|
|
37
|
|
|
$quoteStrategy = $this->createMock(\Doctrine\ORM\Mapping\QuoteStrategy::class); |
|
|
|
|
38
|
|
|
$options->setQuoteStrategy($quoteStrategy); |
39
|
|
|
$this->assertSame($quoteStrategy, $options->getQuoteStrategy()); |
|
|
|
|
40
|
|
|
|
41
|
|
|
$this->expectException(\Laminas\Stdlib\Exception\InvalidArgumentException::class); |
|
|
|
|
42
|
|
|
$options->setQuoteStrategy(new \stdClass()); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function testSetRepositoryFactory() |
46
|
|
|
{ |
47
|
|
|
$options = new Configuration(); |
48
|
|
|
$options->setRepositoryFactory(null); |
49
|
|
|
$this->assertNull($options->getRepositoryFactory()); |
|
|
|
|
50
|
|
|
|
51
|
|
|
$options->setRepositoryFactory('test'); |
52
|
|
|
$this->assertSame('test', $options->getRepositoryFactory()); |
|
|
|
|
53
|
|
|
|
54
|
|
|
$repositoryFactory = new DefaultRepositoryFactory(); |
55
|
|
|
$options->setRepositoryFactory($repositoryFactory); |
56
|
|
|
$this->assertSame($repositoryFactory, $options->getRepositoryFactory()); |
|
|
|
|
57
|
|
|
|
58
|
|
|
$this->expectException(\Laminas\Stdlib\Exception\InvalidArgumentException::class); |
|
|
|
|
59
|
|
|
$options->setRepositoryFactory(new \stdClass()); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function testSetGetEntityListenerResolver() |
63
|
|
|
{ |
64
|
|
|
$options = new Configuration(); |
65
|
|
|
|
66
|
|
|
$options->setEntityListenerResolver(null); |
67
|
|
|
$this->assertNull($options->getEntityListenerResolver()); |
|
|
|
|
68
|
|
|
|
69
|
|
|
$options->setEntityListenerResolver('test'); |
70
|
|
|
$this->assertSame('test', $options->getEntityListenerResolver()); |
|
|
|
|
71
|
|
|
|
72
|
|
|
$entityListenerResolver = $this->createMock(\Doctrine\ORM\Mapping\EntityListenerResolver::class); |
|
|
|
|
73
|
|
|
|
74
|
|
|
$options->setEntityListenerResolver($entityListenerResolver); |
75
|
|
|
$this->assertSame($entityListenerResolver, $options->getEntityListenerResolver()); |
|
|
|
|
76
|
|
|
|
77
|
|
|
$this->expectException(\Laminas\Stdlib\Exception\InvalidArgumentException::class); |
|
|
|
|
78
|
|
|
$options->setEntityListenerResolver(new \stdClass()); |
|
|
|
|
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.