|
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\Collector; |
|
12
|
|
|
|
|
13
|
|
|
use MpaFirephpWrapper\Collector\FirephpCollector; |
|
14
|
|
|
use MpaFirephpWrapper\Service\FirephpWrapper; |
|
15
|
|
|
use MpaFirephpWrapperTest\Util\ServiceManagerFactory; |
|
16
|
|
|
use MpaFirephpWrapper\Options\FirephpWrapperOptions; |
|
17
|
|
|
use PHPUnit\Framework\TestCase; |
|
18
|
|
|
use Zend\Mvc\MvcEvent; |
|
19
|
|
|
|
|
20
|
|
|
class FirephpCollectorTest extends TestCase |
|
21
|
|
|
{ |
|
22
|
|
|
protected $serviceManager; |
|
23
|
|
|
|
|
24
|
|
|
protected function setUp() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->serviceManager = ServiceManagerFactory::getServiceManager(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function testCollector() |
|
30
|
|
|
{ |
|
31
|
|
|
$wrapper = new FirephpWrapper($this->serviceManager->get(FirephpWrapperOptions::class)); |
|
|
|
|
|
|
32
|
|
|
$collector = new FirephpCollector($wrapper); |
|
33
|
|
|
|
|
34
|
|
|
$this->assertEquals('mpa_firephp_wrapper_collector', $collector->getName()); |
|
35
|
|
|
$this->assertEquals(0, $collector->getHowManyLogged()); |
|
36
|
|
|
$this->assertEquals(150, $collector->getPriority()); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function testCollectorCollects() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->serviceManager->get('ViewHelperManager') |
|
42
|
|
|
->get('firephp') |
|
43
|
|
|
->__invoke('something'); |
|
44
|
|
|
$collector = new FirephpCollector($this->serviceManager->get('firephp')); |
|
|
|
|
|
|
45
|
|
|
$collector->collect($this->createMock(MvcEvent::class)); |
|
46
|
|
|
$this->app = $this->serviceManager->get('Application'); |
|
|
|
|
|
|
47
|
|
|
$this->app->bootstrap(); |
|
48
|
|
|
|
|
49
|
|
|
$this->assertEquals(1, $collector->getHowManyLogged()); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
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: