GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a42b47...a111ac )
by Florian
03:12
created

testCreateEmptyDocumentFromCompositeEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 23
rs 9.0856
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Stinger Enity Search package.
5
 *
6
 * (c) Oliver Kotte <[email protected]>
7
 * (c) Florian Meyer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
namespace StingerSoft\EntitySearchBundle\Tests\Services;
13
14
use StingerSoft\EntitySearchBundle\Tests\AbstractORMTestCase;
15
use StingerSoft\EntitySearchBundle\Tests\Fixtures\ORM\Beer;
16
use StingerSoft\EntitySearchBundle\Services\AbstractSearchService;
17
use Doctrine\Common\Persistence\ObjectManager;
18
use StingerSoft\EntitySearchBundle\Model\Document;
19
use StingerSoft\EntitySearchBundle\Tests\Fixtures\ORM\Car;
20
21
class AbstractSearchServiceTest extends AbstractORMTestCase {
22
23
	/**
24
	 *
25
	 * {@inheritDoc}
26
	 *
27
	 * @see PHPUnit_Framework_TestCase::setUp()
28
	 */
29
	public function setUp() {
30
		parent::setUp();
31
		$this->getMockSqliteEntityManager();
32
	}
33
34
	public function testSetObjectManager() {
35
		/**
36
		 *
37
		 * @var AbstractSearchService $service
38
		 */
39
		$service = $this->getMockBuilder(AbstractSearchService::class)->getMockForAbstractClass();
40
		$this->assertNotNull($this->em);
41
		$service->setObjectManager($this->em);
42
		$this->assertNotNull($service->getObjectManager());
43
		$this->assertInstanceOf(ObjectManager::class, $service->getObjectManager());
44
	}
45
46
	public function testCreateEmptyDocumentFromEntity() {
47
		$beer = new Beer();
48
		$beer->setTitle('Hemelinger');
49
		$this->em->persist($beer);
50
		$this->em->flush();
51
		
52
		/**
53
		 *
54
		 * @var AbstractSearchService $service
55
		 */
56
		$service = $this->getMockBuilder(AbstractSearchService::class)->getMockForAbstractClass();
57
		$service->setObjectManager($this->em);
58
		
59
		/**
60
		 *
61
		 * @var Document $doc
62
		 */
63
		$doc = $service->createEmptyDocumentFromEntity($beer);
64
		$this->assertNotNull($doc);
65
		$this->assertInstanceOf(Document::class, $doc);
66
		$this->assertEquals($beer->getId(), $doc->getEntityId());
67
		$this->assertEquals(Beer::class, $doc->getEntityClass());
68
	}
69
	
70
	public function testCreateEmptyDocumentFromCompositeEntity() {
71
		$car = new Car('S500', 2016);
72
		$this->em->persist($car);
73
		$this->em->flush();
74
	
75
		/**
76
		 *
77
		 * @var AbstractSearchService $service
78
		 */
79
		$service = $this->getMockBuilder(AbstractSearchService::class)->getMockForAbstractClass();
80
		$service->setObjectManager($this->em);
81
	
82
		/**
83
		 *
84
		 * @var Document $doc
85
		 */
86
		$doc = $service->createEmptyDocumentFromEntity($car);
87
		$this->assertNotNull($doc);
88
		$this->assertInstanceOf(Document::class, $doc);
89
		$this->assertInternalType('array', $doc->getEntityId());
90
		$this->assertCount(2, $doc->getEntityId());
91
		$this->assertEquals(Car::class, $doc->getEntityClass());
92
	}
93
94
	/**
95
	 *
96
	 * {@inheritDoc}
97
	 *
98
	 * @see \StingerSoft\EntitySearchBundle\Tests\AbstractTestCase::getUsedEntityFixtures()
99
	 */
100
	protected function getUsedEntityFixtures() {
101
		return array(
102
			Beer::class,
103
			Car::class
104
		);
105
	}
106
}