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 ( 50e57a...1d39d2 )
by Florian
03:06
created

QueryTypeTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 7
dl 0
loc 75
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testInitialCall() 0 23 1
B testWithNotExistingFacets() 0 32 1
A getExtensions() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the Stinger Entity 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;
13
14
use Symfony\Component\Form\Test\TypeTestCase;
15
use StingerSoft\EntitySearchBundle\Form\QueryType;
16
use StingerSoft\EntitySearchBundle\Form\FacetType;
17
use StingerSoft\EntitySearchBundle\Model\Query;
18
use Symfony\Component\Form\PreloadedExtension;
19
use StingerSoft\EntitySearchBundle\Model\Document;
20
21
class QueryTypeTest extends TypeTestCase {
22
23
	public function testInitialCall() {
24
		$form = $this->factory->create(QueryType::class);
25
		
26
		$query = new Query('Hemelinger');
27
		
28
		$formData = array(
29
			'searchTerm' => 'Hemelinger' 
30
		);
31
		
32
		// submit the data to the form directly
33
		$form->submit($formData);
34
		
35
		$this->assertTrue($form->isSynchronized());
36
		$this->assertTrue($form->isValid());
37
		$this->assertEquals($query, $form->getData());
38
		
39
		// $view = $form->createView();
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
40
		// $children = $view->children;
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
41
		
42
		// foreach (array_keys($formData) as $key) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
43
		// $this->assertArrayHasKey($key, $children);
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
		// }
45
	}
46
	
47
	
48
	public function testWithNotExistingFacets(){
49
		
50
		$query = new Query('Hemelinger', array(), array(
51
			Document::FIELD_TYPE
52
		));
53
		
54
		$form = $this->factory->create(QueryType::class, $query, array(
55
			'used_facets' => $query->getUsedFacets(),
56
		));
57
		
58
		$expectedQuery = new Query('Hemelinger', array(
59
			Document::FIELD_TYPE => array(
60
				'\StingerSoft\TestBundle\Entity\Test'
61
			)
62
		), array(
63
			Document::FIELD_TYPE
64
		));
65
		
66
		$formData = array(
67
			'searchTerm' => 'Hemelinger',
68
			'facet_type' => array(
69
				'\StingerSoft\TestBundle\Entity\Test'
70
			)
71
		);
72
		
73
		// submit the data to the form directly
74
		$form->submit($formData);
75
		
76
		$this->assertTrue($form->isSynchronized());
77
		$this->assertTrue($form->isValid());
78
		$this->assertEquals($expectedQuery, $form->getData());
79
	}
80
81
	/**
82
	 *
83
	 * {@inheritDoc}
84
	 *
85
	 * @see \Symfony\Component\Form\Test\FormIntegrationTestCase::getExtensions()
86
	 */
87
	protected function getExtensions() {
88
		return array(
89
			new PreloadedExtension(array(
90
				new QueryType(),
91
				new FacetType(), 
92
			), array()) 
93
		);
94
	}
95
}