2016-12-02 03:20:24 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class DocumentationEntityTest extends SapphireTest
|
|
|
|
{
|
2017-08-08 05:50:24 +02:00
|
|
|
public function dataCompare()
|
2016-12-02 03:31:18 +01:00
|
|
|
{
|
2016-12-02 03:20:24 +01:00
|
|
|
return array(
|
|
|
|
array('3', '3.0', 1),
|
|
|
|
array('3.1', '3.1', 0),
|
|
|
|
array('3.0', '3', -1),
|
|
|
|
array('4', '3', 1),
|
|
|
|
array('3', '4', -1),
|
|
|
|
array('3.4.1', '4', -1)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider dataCompare
|
|
|
|
* @param string $left
|
|
|
|
* @param string $right
|
2016-12-02 03:31:18 +01:00
|
|
|
* @param int $result
|
2016-12-02 03:20:24 +01:00
|
|
|
*/
|
2017-08-08 05:50:24 +02:00
|
|
|
public function testCompare($left, $right, $result)
|
2016-12-02 03:31:18 +01:00
|
|
|
{
|
2016-12-02 03:20:24 +01:00
|
|
|
$leftVersion = new DocumentationEntity('Framework');
|
|
|
|
$leftVersion->setVersion($left);
|
|
|
|
|
|
|
|
$rightVersion = new DocumentationEntity('Framework');
|
|
|
|
$rightVersion->setVersion($right);
|
|
|
|
|
|
|
|
$this->assertEquals($result, $leftVersion->compare($rightVersion));
|
|
|
|
}
|
|
|
|
}
|