2017-09-27 09:25:37 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Dev\Tests\SapphireTestTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
class DataProvider implements TestOnly
|
|
|
|
{
|
|
|
|
protected static $oneItemList = [
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Ingo', 'Surname' => 'Schommer'],
|
2017-09-27 09:25:37 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
protected static $twoItemList = [
|
|
|
|
['FirstName' => 'Ingo', 'Surname' => 'Schommer'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam', 'Surname' => 'Minnee'],
|
|
|
|
];
|
|
|
|
|
|
|
|
protected static $memberList = [
|
|
|
|
['FirstName' => 'Ingo', 'Surname' => 'Schommer', 'Locale' => 'en_US'],
|
|
|
|
['FirstName' => 'Sam', 'Surname' => 'Minnee', 'Locale' => 'en_US'],
|
2017-09-27 09:25:37 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function provideEqualListsWithEmptyList()
|
|
|
|
{
|
|
|
|
return array_merge(
|
2017-10-17 09:22:11 +02:00
|
|
|
[
|
|
|
|
'emptyLists' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
[],
|
2017-10-17 09:22:11 +02:00
|
|
|
[],
|
|
|
|
],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
self::provideEqualLists()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function provideEqualLists()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'oneParameterOneItem' => [
|
|
|
|
['FirstName' => 'Ingo'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$oneItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'twoParametersOneItem' => [
|
|
|
|
['FirstName' => 'Ingo', 'Surname' => 'Schommer'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$oneItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
[
|
|
|
|
'oneParameterTwoItems' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'Ingo'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'twoParametersTwoItems' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'Ingo', 'Surname' => 'Schommer'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam', 'Surname' => 'Minnee'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'mixedParametersTwoItems' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'Ingo', 'Surname' => 'Schommer'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function provideNonEqualLists()
|
|
|
|
{
|
|
|
|
|
|
|
|
return [
|
2017-10-17 09:22:11 +02:00
|
|
|
[
|
|
|
|
'checkAgainstEmptyList' => [
|
|
|
|
['FirstName' => 'Ingo'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
[],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'oneItemExpectedListContainsMore' => [
|
|
|
|
['FirstName' => 'Ingo'],
|
|
|
|
],
|
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
[
|
|
|
|
'oneExpectationHasWrontParamter' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'IngoXX'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam'],
|
|
|
|
],
|
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'differentParametersInDifferentItemsAreWrong' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'IngoXXX', 'Surname' => 'Schommer'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam', 'Surname' => 'MinneeXXX'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
'differentParametersNotMatching' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'Daniel', 'Surname' => 'Foo'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Dan'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function provideNotContainingList()
|
|
|
|
{
|
|
|
|
return [
|
2017-10-17 09:22:11 +02:00
|
|
|
'listIsEmpty' => [
|
2017-09-27 09:25:37 +02:00
|
|
|
[
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Ingo'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
[],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
'oneItemIsExpected' => [
|
|
|
|
[
|
|
|
|
['FirstName' => 'Sam'],
|
|
|
|
],
|
|
|
|
self::$oneItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
'twoParametersAreWrong' => [
|
|
|
|
[
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'IngoXXX', 'Surname' => 'Schommer'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Sam', 'Surname' => 'MinneeXXX'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
'mixedList' => [
|
|
|
|
[
|
2017-09-27 09:25:37 +02:00
|
|
|
['FirstName' => 'Daniel', 'Surname' => 'Foo'],
|
2017-10-17 09:22:11 +02:00
|
|
|
['FirstName' => 'Dan'],
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
2017-10-17 09:22:11 +02:00
|
|
|
self::$twoItemList,
|
2017-09-27 09:25:37 +02:00
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function provideAllMatchingList()
|
|
|
|
{
|
|
|
|
return [
|
2017-10-17 09:22:11 +02:00
|
|
|
'emptyMatch' => [
|
|
|
|
[],
|
|
|
|
self::$memberList,
|
|
|
|
'empty list did not match',
|
|
|
|
],
|
|
|
|
'allItemsWithLocaleSet' => [
|
|
|
|
['Locale' => 'en_US'],
|
|
|
|
self::$memberList,
|
|
|
|
'list with Locale set in all items did not match',
|
|
|
|
],
|
2017-09-27 09:25:37 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function provideNotMatchingList()
|
|
|
|
{
|
|
|
|
return [
|
2017-10-17 09:22:11 +02:00
|
|
|
'notAllItemsHaveLocaleSet' => [['FirstName' => 'Ingo'], self::$memberList],
|
2017-09-27 09:25:37 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|