mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-26 17:43:54 +00:00
fix cs
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user