1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
4
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
5
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
6
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
7
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
8
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace MpaFirephpWrapperTest\Service; |
12
|
|
|
|
13
|
|
|
use MpaFirephpWrapper\Options\FirephpWrapperOptions; |
14
|
|
|
use MpaFirephpWrapper\Service\FirephpWrapper; |
15
|
|
|
use MpaFirephpWrapperTest\Util\ServiceManagerFactory; |
16
|
|
|
use PHPUnit\Framework\TestCase; |
17
|
|
|
|
18
|
|
|
class FirephpWrapperTest extends TestCase |
19
|
|
|
{ |
20
|
|
|
protected $serviceManager; |
21
|
|
|
|
22
|
|
|
protected function setUp() |
23
|
|
|
{ |
24
|
|
|
$this->serviceManager = ServiceManagerFactory::getServiceManager(); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testFirephpWrapperReallyWrapsFirePHP() |
28
|
|
|
{ |
29
|
|
|
$wrapper = (new FirephpWrapper($this->serviceManager->get(FirephpWrapperOptions::class)))->getFirephp(); |
|
|
|
|
30
|
|
|
$this->assertInstanceOf('FirePHP', $wrapper); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testNoConfigProvidedIsNotAProblem() |
34
|
|
|
{ |
35
|
|
|
$config = ServiceManagerFactory::getApplicationConfig(); |
36
|
|
|
unset($config['module_listener_options']['config_glob_paths'][0]); |
37
|
|
|
|
38
|
|
|
$wrapper = ( |
39
|
|
|
new FirephpWrapper( |
40
|
|
|
ServiceManagerFactory::getServiceManager($config)->get(FirephpWrapperOptions::class) |
|
|
|
|
41
|
|
|
) |
42
|
|
|
) |
43
|
|
|
->getFirephp(); |
44
|
|
|
$this->assertInstanceOf('FirePHP', $wrapper); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: