1 | <?php |
||
2 | |||
3 | namespace SilverStripe\ModuleRatings\Tests; |
||
4 | |||
5 | use PHPUnit\Framework\TestCase; |
||
6 | use SilverStripe\ModuleRatings\Calculator; |
||
7 | |||
8 | class CalculatorTest extends TestCase |
||
9 | { |
||
10 | public function testGetInstance() |
||
11 | { |
||
12 | $instanceA = Calculator::getInstance(); |
||
13 | $instanceB = Calculator::getInstance(); |
||
14 | |||
15 | $this->assertSame($instanceA, $instanceB); |
||
16 | } |
||
17 | |||
18 | public function testCalculate() |
||
19 | { |
||
20 | $mock = $this->getMockBuilder(Calculator::class) |
||
0 ignored issues
–
show
|
|||
21 | ->setMethods(['getMaxPoints']) |
||
22 | ->getMock(); |
||
23 | |||
24 | $mock->expects($this->exactly(3))->method('getMaxPoints')->willReturn(140); |
||
25 | |||
26 | $this->assertEquals(70, $mock->calculate(98)); |
||
27 | $this->assertEquals(0, $mock->calculate(0)); |
||
28 | $this->assertEquals(100, $mock->calculate(139)); |
||
29 | } |
||
30 | } |
||
31 |
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.