mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
34 lines
834 B
PHP
34 lines
834 B
PHP
<?php
|
|
|
|
class DocumentationEntityTest extends SapphireTest
|
|
{
|
|
public function dataCompare()
|
|
{
|
|
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
|
|
* @param int $result
|
|
*/
|
|
public function testCompare($left, $right, $result)
|
|
{
|
|
$leftVersion = new DocumentationEntity('Framework');
|
|
$leftVersion->setVersion($left);
|
|
|
|
$rightVersion = new DocumentationEntity('Framework');
|
|
$rightVersion->setVersion($right);
|
|
|
|
$this->assertEquals($result, $leftVersion->compare($rightVersion));
|
|
}
|
|
}
|