Issues (28)

tests/cli/Manager/StatusManagerTest.php (2 issues)

1
<?php
2
3
namespace Jalle19\StatusManager\Test\Manager;
4
5
use Jalle19\StatusManager\Event\Events;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
8
/**
9
 * Class StatusManagerTest
10
 * @package   Jalle19\StatusManager\Test\Manager
11
 * @copyright Copyright &copy; Sam Stenvall 2016-
12
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
13
 */
14
class StatusManagerTest extends AbstractManagerTest
15
{
16
17
	/**
18
	 *
19
	 */
20
	public function testEventHandling()
21
	{
22
		/* @var EventSubscriberInterface|\PHPUnit_Framework_MockObject_MockObject $statusManager */
23
		$statusManager = $this->getMockBuilder('\Jalle19\StatusManager\Manager\StatusManager')
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

23
		$statusManager = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder('\Jalle19\StatusManager\Manager\StatusManager')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
24
		                      ->setConstructorArgs([$this->configuration, $this->logger, $this->eventDispatcher])
25
		                      ->setMethods(['onMainLoopStarted', 'onMainLoopTick'])
26
		                      ->getMock();
27
28
		$statusManager->expects($this->once())
0 ignored issues
show
The method expects() does not exist on Symfony\Component\EventD...ventSubscriberInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
		$statusManager->/** @scrutinizer ignore-call */ 
29
                  expects($this->once())

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
		              ->method('onMainLoopStarted');
30
		$statusManager->expects($this->once())
31
		              ->method('onMainLoopTick');
32
33
		$this->eventDispatcher->addSubscriber($statusManager);
34
		$this->eventDispatcher->dispatch(Events::MAIN_LOOP_STARTING);
35
		$this->eventDispatcher->dispatch(Events::MAIN_LOOP_TICK);
36
	}
37
38
}
39