This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace SumoCoders\FrameworkSettingsBundle\Tests\Service; |
||
4 | |||
5 | use SumoCoders\FrameworkSettingsBundle\Entity\Setting; |
||
6 | use SumoCoders\FrameworkSettingsBundle\SettingsManager; |
||
7 | |||
8 | class SettingsTest extends \PHPUnit_Framework_TestCase |
||
9 | { |
||
10 | /** |
||
11 | * @var SettingsManager |
||
12 | */ |
||
13 | protected $settings; |
||
14 | |||
15 | /** |
||
16 | * {@inheritdoc} |
||
17 | */ |
||
18 | public function setUp() |
||
19 | { |
||
20 | $entityManager = $this |
||
21 | ->getMockBuilder('\Doctrine\Common\Persistence\ObjectManager') |
||
22 | ->disableOriginalConstructor() |
||
23 | ->getMock(); |
||
24 | |||
25 | $repository = $this->getMockBuilder('Doctrine\ORM\EntityRepository') |
||
26 | ->disableOriginalConstructor() |
||
27 | ->getMock(); |
||
28 | |||
29 | $this->settings = new SettingsManager( |
||
30 | $entityManager, |
||
31 | $repository |
||
32 | ); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function tearDown() |
||
39 | { |
||
40 | $this->settings = null; |
||
41 | } |
||
42 | |||
43 | public function testClearIsNotImplemented() |
||
44 | { |
||
45 | $this->setExpectedException( |
||
0 ignored issues
–
show
|
|||
46 | 'SumoCoders\FrameworkSettingsBundle\Exception\DontUseException' |
||
47 | ); |
||
48 | $this->settings->clear(); |
||
49 | } |
||
50 | |||
51 | public function testAddInvalidItem() |
||
52 | { |
||
53 | $this->setExpectedException( |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
54 | 'SumoCoders\FrameworkSettingsBundle\Exception\InvalidInstanceException' |
||
55 | ); |
||
56 | |||
57 | $invalidItem = new \StdClass(); |
||
58 | $this->settings->add( |
||
59 | array($invalidItem) |
||
60 | ); |
||
61 | } |
||
62 | |||
63 | public function testAddValidItems() |
||
64 | { |
||
65 | $setting1 = new Setting(); |
||
66 | $setting1->setName('name') |
||
67 | ->setValue('John Doe'); |
||
68 | $setting2 = new Setting(); |
||
69 | $setting2->setName('foo') |
||
70 | ->setValue('bar'); |
||
71 | |||
72 | $this->settings->add( |
||
73 | array( |
||
74 | $setting1, |
||
75 | $setting2 |
||
76 | ) |
||
77 | ); |
||
78 | |||
79 | $this->assertTrue($this->settings->has('name')); |
||
80 | $this->assertEquals($setting1->getValue(), $this->settings->get('name')); |
||
81 | $this->assertTrue($this->settings->has('foo')); |
||
82 | $this->assertEquals($setting2->getValue(), $this->settings->get('foo')); |
||
83 | } |
||
84 | |||
85 | public function testGetAll() |
||
86 | { |
||
87 | $setting1 = new Setting(); |
||
88 | $setting1->setName('name') |
||
89 | ->setValue('John Doe'); |
||
90 | $setting2 = new Setting(); |
||
91 | $setting2->setName('foo') |
||
92 | ->setValue('bar'); |
||
93 | |||
94 | $this->settings->add( |
||
95 | array( |
||
96 | $setting1, |
||
97 | $setting2 |
||
98 | ) |
||
99 | ); |
||
100 | |||
101 | $all = $this->settings->all(); |
||
102 | |||
103 | $this->assertArrayHasKey( |
||
104 | $setting1->getName(), |
||
105 | $all |
||
106 | ); |
||
107 | $this->assertArrayHasKey( |
||
108 | $setting2->getName(), |
||
109 | $all |
||
110 | ); |
||
111 | } |
||
112 | |||
113 | public function testSetSimpleValue() |
||
114 | { |
||
115 | $this->settings->set('name', 'John Doe'); |
||
116 | $this->assertTrue($this->settings->has('name')); |
||
117 | $this->assertEquals('John Doe', $this->settings->get('name')); |
||
118 | } |
||
119 | |||
120 | public function testHasInvalidItem() |
||
121 | { |
||
122 | $this->assertFalse($this->settings->has('foobar')); |
||
123 | } |
||
124 | |||
125 | public function testHasValidItem() |
||
126 | { |
||
127 | $this->settings->set('foo', 'bar'); |
||
128 | $this->assertTrue($this->settings->has('foo')); |
||
129 | } |
||
130 | |||
131 | public function testResolveIsNotImplemented() |
||
132 | { |
||
133 | $this->setExpectedException( |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
134 | 'SumoCoders\FrameworkSettingsBundle\Exception\DontUseException' |
||
135 | ); |
||
136 | $this->settings->resolve(); |
||
137 | } |
||
138 | |||
139 | public function testResolveValueIsNotImplemented() |
||
140 | { |
||
141 | $this->setExpectedException( |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
142 | 'SumoCoders\FrameworkSettingsBundle\Exception\DontUseException' |
||
143 | ); |
||
144 | $this->settings->resolveValue('foo'); |
||
145 | } |
||
146 | |||
147 | public function testEscapeValueIsNotImplemented() |
||
148 | { |
||
149 | $this->setExpectedException( |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
150 | 'SumoCoders\FrameworkSettingsBundle\Exception\DontUseException' |
||
151 | ); |
||
152 | $this->settings->escapeValue('foo'); |
||
153 | } |
||
154 | |||
155 | public function testUnescapeValueIsNotImplemented() |
||
156 | { |
||
157 | $this->setExpectedException( |
||
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. ![]() |
|||
158 | 'SumoCoders\FrameworkSettingsBundle\Exception\DontUseException' |
||
159 | ); |
||
160 | $this->settings->unescapeValue('foo'); |
||
161 | } |
||
162 | } |
||
163 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.