Issues (28)

tests/cli/Database/SubscriptionQueryTest.php (2 issues)

1
<?php
2
3
namespace Jalle19\StatusManager\Test\Database;
4
5
use Jalle19\StatusManager\Database\SubscriptionQuery;
6
use Jalle19\StatusManager\TimeFrame;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * Class SubscriptionQueryTest
11
 * @package   Jalle19\StatusManager\Test\Database
12
 * @copyright Copyright &copy; Sam Stenvall 2016-
13
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
14
 */
15
class SubscriptionQueryTest extends TestCase
16
{
17
18
	/**
19
	 * Checks that filtering is applied appropriately depending on the specified time frame
20
	 * @dataProvider provider
21
	 */
22
	public function testFilterByTimeFrame($expects, $timeFrame)
23
	{
24
		/* @var \PHPUnit_Framework_MockObject_MockObject|SubscriptionQuery $mock */
25
		$mock = $this->getMockBuilder(SubscriptionQuery::class)
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

25
		$mock = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(SubscriptionQuery::class)

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...
26
		             ->setMethods(['filterByStopped'])
27
		             ->getMock();
28
29
		$mock->expects($expects)
0 ignored issues
show
The method expects() does not exist on Jalle19\StatusManager\Database\SubscriptionQuery. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

29
		$mock->/** @scrutinizer ignore-call */ 
30
         expects($expects)
Loading history...
30
		     ->method('filterByStopped');
31
32
		$mock->filterByTimeFrame(new TimeFrame($timeFrame));
33
	}
34
35
36
	/**
37
	 * @return array
38
	 */
39
	public function provider()
40
	{
41
		return [
42
			[$this->never(), TimeFrame::TIME_FRAME_ALL_TIME],
43
			[$this->once(), TimeFrame::TIME_FRAME_LAST_MONTH],
44
			[$this->once(), TimeFrame::TIME_FRAME_LAST_WEEK],
45
			[$this->once(), TimeFrame::TIME_FRAME_LAST_DAY],
46
		];
47
	}
48
49
}
50