This commit is contained in:
2025-06-20 17:31:13 +02:00
parent 9158e33854
commit a38116cca4
65 changed files with 2298 additions and 2298 deletions

View File

@@ -49,80 +49,6 @@ final class CustomFieldsChoiceTest extends KernelTestCase
parent::tearDown();
}
/**
* provide empty data in different possible representations.
* Those data are supposed to be deserialized.
*
* @return array
*/
public static function emptyDataProvider()
{
return [
// 0
[
// signle
'',
],
// 1
[
// single
null,
],
// 2
[
// signle with allow other
['_other' => 'something', '_choices' => ''],
],
// 3
[
// multiple
[],
],
// 4
[
// multiple with allow other
['_other' => 'something', '_choices' => []],
],
// 5
[
// multiple with allow other
['_other' => '', '_choices' => []],
],
// 6
[
// empty
['_other' => null, '_choices' => null],
],
// 7
[
// empty
[null],
],
];
}
public static function serializedRepresentationDataProvider()
{
return [
[
// multiple => false, allow_other => false
'my-value',
],
[
// multiple => true, allow_ther => false
['my-value'],
],
[
// multiple => false, allow_other => true, current value not in other
['_other' => '', '_choices' => 'my-value'],
],
[
// multiple => true, allow_other => true, current value not in other
['_other' => '', '_choices' => ['my-value']],
],
];
}
/**
* Test if the representation of the data is deserialized to an array text
* with an "allow_other" field.
@@ -412,6 +338,58 @@ final class CustomFieldsChoiceTest extends KernelTestCase
$this->assertTrue($isEmpty);
}
/**
* provide empty data in different possible representations.
* Those data are supposed to be deserialized.
*
* @return array
*/
public static function emptyDataProvider()
{
return [
// 0
[
// signle
'',
],
// 1
[
// single
null,
],
// 2
[
// signle with allow other
['_other' => 'something', '_choices' => ''],
],
// 3
[
// multiple
[],
],
// 4
[
// multiple with allow other
['_other' => 'something', '_choices' => []],
],
// 5
[
// multiple with allow other
['_other' => '', '_choices' => []],
],
// 6
[
// empty
['_other' => null, '_choices' => null],
],
// 7
[
// empty
[null],
],
];
}
// ///////////////////////////////////////
//
// test function isEmptyValue
@@ -435,6 +413,28 @@ final class CustomFieldsChoiceTest extends KernelTestCase
$this->assertFalse($isEmpty);
}
public static function serializedRepresentationDataProvider()
{
return [
[
// multiple => false, allow_other => false
'my-value',
],
[
// multiple => true, allow_ther => false
['my-value'],
],
[
// multiple => false, allow_other => true, current value not in other
['_other' => '', '_choices' => 'my-value'],
],
[
// multiple => true, allow_other => true, current value not in other
['_other' => '', '_choices' => ['my-value']],
],
];
}
/**
* @param array $options
*