forked from doctrine/search
/
ConfigurationTest.php
92 lines (74 loc) · 2.84 KB
/
ConfigurationTest.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
namespace Unit\Doctrine\Search;
use Doctrine\Search\Configuration;
/**
* Test class for Configuration.
* Generated by PHPUnit on 2011-12-11 at 15:44:56.
*/
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Configuration
*/
protected $configuration;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->configuration = new Configuration();
}
public function testGetMetadataDriverImpl()
{
$metadataDriverImpl = $this->configuration->getMetadataDriverImpl();
$this->assertInstanceOf('\Doctrine\Search\Mapping\Driver\AnnotationDriver', $metadataDriverImpl);
}
public function testSetMetadataDriverImpl()
{
$mockedMetadataDriverImpl = $this->getMock('\\Doctrine\\Search\\Mapping\\Driver\\Driver'
, array(), array(), '', false);
$this->configuration->setMetadataDriverImpl($mockedMetadataDriverImpl);
$metadataDriverImpl = $this->configuration->getMetadataDriverImpl();
$this->assertInstanceOf('\Doctrine\Search\Mapping\Driver\Driver', $metadataDriverImpl);
}
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testSetMetadataCacheImplWrongParameter()
{
$this->configuration->setMetadataCacheImpl(array());
}
public function testSetMetadataCacheImpl()
{
$mockedMetadataCacheImpl = $this->getMock('\Doctrine\Common\Cache\Cache');
$this->configuration->setMetadataCacheImpl($mockedMetadataCacheImpl);
$cacheMetadataImpl = $this->configuration->getMetadataCacheImpl();
$this->assertInstanceOf('\Doctrine\Common\Cache\Cache', $cacheMetadataImpl);
}
public function testNewDefaultAnnotationDriver()
{
$defaultAnnotationDriver = $this->configuration->newDefaultAnnotationDriver();
$this->assertInstanceOf('\Doctrine\Search\Mapping\Driver\AnnotationDriver', $defaultAnnotationDriver);
}
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testNewDefaultAnnotationDriverWrongParameter()
{
$this->configuration->newDefaultAnnotationDriver(new \StdClass());
}
public function testSetClassMetadataFactoryName()
{
$this->configuration = new Configuration();
$this->configuration->setClassMetadataFactoryName('test');
$this->assertEquals('test', $this->configuration->getClassMetadataFactoryName());
}
public function testGetClassMetadataFactoryName()
{
$this->configuration = new Configuration();
$className = $this->configuration->getClassMetadataFactoryName();
$this->assertEquals($className, 'Doctrine\Search\Mapping\ClassMetadataFactory');
}
}
?>