qa: Replace array by data providers in unit tests
MODIFY
test/DigitsTest.php
test/DigitsTest.php
@@ -16,9 +16,7 @@ use PHPUnit\Framework\TestCase;
*/
class DigitsTest extends TestCase
{
- /**
- * @var Digits
- */
+ /** @var Digits */
protected $validator;
protected function setUp() : void
@@ -29,24 +27,30 @@ class DigitsTest extends TestCase
/**
* Ensures that the validator follows expected behavior for basic input values
*
+ * @dataProvider basicDataProvider
* @return void
*/
- public function testExpectedResultsWithBasicInputValues()
+ public function testExpectedResultsWithBasicInputValues(string $input, bool $expected)
{
- $valuesExpected = [
- 'abc123' => false,
- 'abc 123' => false,
- 'abcxyz' => false,
- 'AZ@#4.3' => false,
- '1.23' => false,
- '0x9f' => false,
- '123' => true,
- '09' => true,
- '' => false,
- ];
- foreach ($valuesExpected as $input => $result) {
- $this->assertEquals($result, $this->validator->isValid($input));
+ $this->assertSame($expected, $this->validator->isValid($input));
}
+
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'invalid; starts with alphabetic chars' => ['abc123', false],
+ 'invalid; contains alphabetic chars and one whitespace' => ['abc 123', false],
+ 'invalid; contains only alphabetic chars' => ['abcxyz', false],
+ 'invalid; contains alphabetic and special chars' => ['AZ@#4.3', false],
+ 'invalid; is a float' => ['1.23', false],
+ 'invalid; is a hexa notation' => ['0x9f', false],
+ 'invalid; is empty' => ['', false],
+
+ 'valid; is a normal integer' => ['123', true],
+ 'valid; starts with a zero' => ['09', true],
+ // phpcs:enable
+ ];
}
/**

MODIFY
test/File/CountTest.php
test/File/CountTest.php
@@ -21,41 +21,42 @@ class CountTest extends TestCase
/**
* Ensures that the validator follows expected behavior
*
+ * @dataProvider basicDataProvider
+ * @param array|int $options
* @return void
*/
- public function testBasic()
- {
- $valuesExpected = [
- [5, true, true, true, true],
- [['min' => 0, 'max' => 3], true, true, true, false],
- [['min' => 2, 'max' => 3], false, true, true, false],
- [['min' => 2], false, true, true, true],
- [['max' => 5], true, true, true, true],
- ];
-
- foreach ($valuesExpected as $element) {
- $validator = new File\Count($element[0]);
- $this->assertEquals(
- $element[1],
- $validator->isValid(__DIR__ . '/_files/testsize.mo'),
- 'Tested with ' . var_export($element, 1)
+ public function testBasic($options, bool $expected1, bool $expected2, bool $expected3, bool $expected4)
+ {
+ $validator = new File\Count($options);
+ $this->assertSame(
+ $expected1,
+ $validator->isValid(__DIR__ . '/_files/testsize.mo')
);
- $this->assertEquals(
- $element[2],
- $validator->isValid(__DIR__ . '/_files/testsize2.mo'),
- 'Tested with ' . var_export($element, 1)
+ $this->assertSame(
+ $expected2,
+ $validator->isValid(__DIR__ . '/_files/testsize2.mo')
);
- $this->assertEquals(
- $element[3],
- $validator->isValid(__DIR__ . '/_files/testsize3.mo'),
- 'Tested with ' . var_export($element, 1)
+ $this->assertSame(
+ $expected3,
+ $validator->isValid(__DIR__ . '/_files/testsize3.mo')
);
- $this->assertEquals(
- $element[4],
- $validator->isValid(__DIR__ . '/_files/testsize4.mo'),
- 'Tested with ' . var_export($element, 1)
+ $this->assertSame(
+ $expected4,
+ $validator->isValid(__DIR__ . '/_files/testsize4.mo')
);
}
+
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'no minimum; maximum: 5; integer' => [5, true, true, true, true],
+ 'no minimum; maximum: 5; array' => [['max' => 5], true, true, true, true],
+ 'minimum: 0; maximum: 3' => [['min' => 0, 'max' => 3], true, true, true, false],
+ 'minimum: 2; maximum: 3' => [['min' => 2, 'max' => 3], false, true, true, false],
+ 'minimum: 2; no maximum' => [['min' => 2], false, true, true, true],
+ // phpcs:enable
+ ];
}
/**

MODIFY
test/File/FilesSizeTest.php
test/File/FilesSizeTest.php
@@ -28,50 +28,58 @@ class FilesSizeTest extends TestCase
/**
* Ensures that the validator follows expected behavior
*
+ * @dataProvider basicDataProvider
+ * @param array|int $options
* @return void
*/
- public function testBasic()
+ public function testBasic($options, bool $expected1, bool $expected2, bool $expected3)
{
- $valuesExpected = [
- [['min' => 0, 'max' => 2000], true, true, false],
- [['min' => 0, 'max' => '2 MB'], true, true, true],
- [['min' => 0, 'max' => '2MB'], true, true, true],
- [['min' => 0, 'max' => '2 MB'], true, true, true],
- [2000, true, true, false],
- [['min' => 0, 'max' => 500], false, false, false],
- [500, false, false, false],
- ];
-
- foreach ($valuesExpected as $element) {
- $validator = new File\FilesSize($element[0]);
- $this->assertEquals(
- $element[1],
- $validator->isValid(__DIR__ . '/_files/testsize.mo'),
- 'Tested with ' . var_export($element, 1)
+ $validator = new File\FilesSize(...$options);
+ $this->assertSame(
+ $expected1,
+ $validator->isValid(__DIR__ . '/_files/testsize.mo')
);
- $this->assertEquals(
- $element[2],
- $validator->isValid(__DIR__ . '/_files/testsize2.mo'),
- 'Tested with ' . var_export($element, 1)
+ $this->assertSame(
+ $expected2,
+ $validator->isValid(__DIR__ . '/_files/testsize2.mo')
);
- $this->assertEquals(
- $element[3],
- $validator->isValid(__DIR__ . '/_files/testsize3.mo'),
- 'Tested with ' . var_export($element, 1)
+ $this->assertSame(
+ $expected3,
+ $validator->isValid(__DIR__ . '/_files/testsize3.mo')
);
}
- $validator = new File\FilesSize(['min' => 0, 'max' => 200]);
- $this->assertEquals(false, $validator->isValid(__DIR__ . '/_files/nofile.mo'));
- $this->assertArrayHasKey('fileFilesSizeNotReadable', $validator->getMessages());
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'minimum: 0 byte; maximum: 500 bytes; integer' => [[500], false, false, false],
+ 'minimum: 0 byte; maximum: 500 bytes; array' => [[['min' => 0, 'max' => 500]], false, false, false],
+ 'minimum: 0 byte; maximum: 2000 bytes; integer' => [[2000], true, true, false],
+ 'minimum: 0 byte; maximum: 2000 bytes; array' => [[['min' => 0, 'max' => 2000]], true, true, false],
+ 'minimum: 0 byte; maximum: 500 kilobytes' => [[['min' => 0, 'max' => 500000]], true, true, true],
+ 'minimum: 0 byte; maximum: 2 megabytes; 2 MB' => [[['min' => 0, 'max' => '2 MB']], true, true, true],
+ 'minimum: 0 byte; maximum: 2 megabytes; 2MB' => [[['min' => 0, 'max' => '2MB']], true, true, true],
+ 'minimum: 0 byte; maximum: 2 megabytes; 2 MB' => [[['min' => 0, 'max' => '2 MB']], true, true, true],
+ // phpcs:enable
+ ];
+ }
+ public function testMultipleFiles()
+ {
$validator = new File\FilesSize(['min' => 0, 'max' => 500000]);
$this->assertEquals(true, $validator->isValid([
__DIR__ . '/_files/testsize.mo',
__DIR__ . '/_files/testsize.mo',
__DIR__ . '/_files/testsize2.mo',
]));
- $this->assertEquals(true, $validator->isValid(__DIR__ . '/_files/testsize.mo'));
+ }
+
+ public function testFileDoNotExist()
+ {
+ $validator = new File\FilesSize(['min' => 0, 'max' => 200]);
+ $this->assertEquals(false, $validator->isValid(__DIR__ . '/_files/nofile.mo'));
+ $this->assertArrayHasKey('fileFilesSizeNotReadable', $validator->getMessages());
}
/**

MODIFY
test/GreaterThanTest.php
test/GreaterThanTest.php
@@ -19,33 +19,79 @@ class GreaterThanTest extends TestCase
/**
* Ensures that the validator follows expected behavior
*
+ * @dataProvider basicDataProvider
+ * @param int|string $input
* @return void
*/
- public function testBasic()
+ public function testBasic(array $options, $input, bool $expected)
{
- /**
- * The elements of each array are, in order:
- * - minimum
- * - expected validation result
- * - array of test input values
- */
- $valuesExpected = [
- [0, true, [0.01, 1, 100]],
- [0, false, [0, 0.00, -0.01, -1, -100]],
- ['a', true, ['b', 'c', 'd']],
- ['z', false, ['x', 'y', 'z']],
- [['min' => 0, 'inclusive' => true], true, [0, 0.00, 0.01, 1, 100]],
- [['min' => 0, 'inclusive' => true], false, [-0.01, -1, -100]],
- [['min' => 0, 'inclusive' => false], true, [0.01, 1, 100]],
- [['min' => 0, 'inclusive' => false], false, [0, 0.00, -0.01, -1, -100]],
- ];
-
- foreach ($valuesExpected as $element) {
- $validator = new GreaterThan($element[0]);
- foreach ($element[2] as $input) {
- $this->assertEquals($element[1], $validator->isValid($input));
- }
+ $validator = new GreaterThan(...$options);
+ $this->assertSame($expected, $validator->isValid($input));
}
+
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'valid; non inclusive; 0 < 0.01' => [[0], 0.01, true],
+ 'valid; non inclusive; 0 < 1' => [[0], 1, true],
+ 'valid; non inclusive; 0 < 100' => [[0], 100, true],
+
+ 'invalid; non inclusive; 0 >= 0' => [[0], 0, false],
+ 'invalid; non inclusive; 0 >= 0.00' => [[0], 0.00, false],
+ 'invalid; non inclusive; 0 >= -0.01' => [[0], -0.01, false],
+ 'invalid; non inclusive; 0 >= -1' => [[0], -1, false],
+ 'invalid; non inclusive; 0 >= -100' => [[0], -100, false],
+
+ 'valid; inclusive; 0 <= 0' => [[0, true], 0, true],
+ 'valid; inclusive; 0 <= 0.00' => [[0, true], 0.00, true],
+ 'valid; inclusive; 0 <= 0.01' => [[0, true], 0.01, true],
+ 'valid; inclusive; 0 <= 1' => [[0, true], 1, true],
+ 'valid; inclusive; 0 <= 100' => [[0, true], 100, true],
+
+ 'invalid; inclusive; 0 >= -0.01' => [[0, true], -0.01, false],
+ 'invalid; inclusive; 0 >= -1' => [[0, true], -1, false],
+ 'invalid; inclusive; 0 >= -100' => [[0, true], -100, false],
+
+ 'valid; non inclusive; a < b' => [['a'], 'b', true],
+ 'valid; non inclusive; a < c' => [['a'], 'c', true],
+ 'valid; non inclusive; a < d' => [['a'], 'd', true],
+
+ 'valid; inclusive; a <= a' => [['a', true], 'a', true],
+ 'valid; inclusive; a <= b' => [['a', true], 'b', true],
+ 'valid; inclusive; a <= c' => [['a', true], 'c', true],
+ 'valid; inclusive; a <= d' => [['a', true], 'd', true],
+
+ 'invalid; non-inclusive; a >= a' => [['a', false], 'a', false],
+
+ 'invalid; non inclusive; z >= x' => [['z'], 'x', false],
+ 'invalid; non inclusive; z >= y' => [['z'], 'y', false],
+ 'invalid; non inclusive; z >= z' => [['z'], 'z', false],
+
+ 'invalid; inclusive; z > x' => [['z', true], 'x', false],
+ 'invalid; inclusive; z > y' => [['z', true], 'y', false],
+
+ 'valid; inclusive; 0 <= 0; array' => [[['min' => 0, 'inclusive' => true]], 0, true],
+ 'valid; inclusive; 0 <= 0.00; array' => [[['min' => 0, 'inclusive' => true]], 0.00, true],
+ 'valid; inclusive; 0 <= 0.01; array' => [[['min' => 0, 'inclusive' => true]], 0.01, true],
+ 'valid; inclusive; 0 <= 1; array' => [[['min' => 0, 'inclusive' => true]], 1, true],
+ 'valid; inclusive; 0 <= 100; array' => [[['min' => 0, 'inclusive' => true]], 100, true],
+
+ 'invalid; inclusive; 0 >= -0.01; array' => [[['min' => 0, 'inclusive' => true]], -0.01, false],
+ 'invalid; inclusive; 0 >= -1; array' => [[['min' => 0, 'inclusive' => true]], -1, false],
+ 'invalid; inclusive; 0 >= -100; array' => [[['min' => 0, 'inclusive' => true]], -100, false],
+
+ 'valid; non inclusive; 0 < 0.01; array' => [[['min' => 0, 'inclusive' => false]], 0.01, true],
+ 'valid; non inclusive; 0 < 1; array' => [[['min' => 0, 'inclusive' => false]], 1, true],
+ 'valid; non inclusive; 0 < 100; array' => [[['min' => 0, 'inclusive' => false]], 100, true],
+
+ 'invalid; non inclusive; 0 >= 0; array' => [[['min' => 0, 'inclusive' => false]], 0, false],
+ 'invalid; non inclusive; 0 >= 0.00; array' => [[['min' => 0, 'inclusive' => false]], 0.00, false],
+ 'invalid; non inclusive; 0 >= -0.01; array' => [[['min' => 0, 'inclusive' => false]], -0.01, false],
+ 'invalid; non inclusive; 0 >= -1; array' => [[['min' => 0, 'inclusive' => false]], -1, false],
+ 'invalid; non inclusive; 0 >= -100; array' => [[['min' => 0, 'inclusive' => false]], -100, false],
+ // phpcs:enable
+ ];
}
/**
@@ -101,32 +147,50 @@ class GreaterThanTest extends TestCase
);
}
- public function testCorrectInclusiveMessageReturn()
+ /**
+ * @dataProvider correctInclusiveMessageDataProvider
+ */
+ public function testCorrectInclusiveMessageReturn(float $input)
{
- $valuesToValidate = [0, 0.5, 5, 10];
-
- foreach ($valuesToValidate as $value) {
$validator = new GreaterThan(10);
- $validator->isValid($value);
+ $validator->isValid($input);
$message = $validator->getMessages();
$this->assertArrayHaskey('notGreaterThan', $message);
$this->assertEquals($message['notGreaterThan'], "The input is not greater than '10'");
}
- }
- public function testCorrectNotInclusiveMessageReturn()
+ public function correctInclusiveMessageDataProvider()
{
- $valuesToValidate = [0, 0.5, 5, 9];
+ return [
+ '0' => [0],
+ '0.5' => [0.5],
+ '5' => [5],
+ '10' => [10],
+ ];
+ }
- foreach ($valuesToValidate as $value) {
+ /**
+ * @dataProvider correctNotInclusiveMessageDataProvider
+ */
+ public function testCorrectNotInclusiveMessageReturn(float $input)
+ {
$validator = new GreaterThan(['min' => 10, 'inclusive' => true]);
- $validator->isValid($value);
+ $validator->isValid($input);
$message = $validator->getMessages();
$this->assertArrayHaskey('notGreaterThanInclusive', $message);
$this->assertEquals($message['notGreaterThanInclusive'], "The input is not greater than or equal to '10'");
}
+
+ public function correctNotInclusiveMessageDataProvider()
+ {
+ return [
+ '0' => [0],
+ '0.5' => [0.5],
+ '5' => [5],
+ '9' => [9],
+ ];
}
public function testConstructorCanAcceptInclusiveFlagAsAnArgument()

MODIFY
test/HexTest.php
test/HexTest.php
@@ -29,25 +29,31 @@ class HexTest extends TestCase
/**
* Ensures that the validator follows expected behavior
*
+ * @dataProvider basicDataProvider
+ * @param int|string $input
* @return void
*/
- public function testBasic()
+ public function testBasic($input, bool $expected)
{
- $valuesExpected = [
- [1, true],
- [0x1, true],
- [0x123, true],
- ['1', true],
- ['abc123', true],
- ['ABC123', true],
- ['1234567890abcdef', true],
- ['g', false],
- ['1.2', false],
- ];
-
- foreach ($valuesExpected as $element) {
- $this->assertEquals($element[1], $this->validator->isValid($element[0]), $element[0]);
+ $this->assertSame($expected, $this->validator->isValid($input));
}
+
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'valid; int; 1' => [1, true],
+ 'valid; hex; 0x1' => [0x1, true],
+ 'valid; hex; 0x123' => [0x123, true],
+ 'valid; string; 1' => ['1', true],
+ 'valid; string; abc123' => ['abc123', true],
+ 'valid; string; ABC123' => ['ABC123', true],
+ 'valid; string; 1234567890abcdef' => ['1234567890abcdef', true],
+
+ 'invalid; string; g' => ['g', false],
+ 'invalid; string; 1.2' => ['1.2', false],
+ // phpcs:enable
+ ];
}
/**

MODIFY
test/LessThanTest.php
test/LessThanTest.php
@@ -19,33 +19,75 @@ class LessThanTest extends TestCase
/**
* Ensures that the validator follows expected behavior
*
+ * @dataProvider basicDataProvider
+ * @param int|string $input
* @return void
*/
- public function testBasic()
+ public function testBasic(array $options, $input, bool $expected)
{
- /**
- * The elements of each array are, in order:
- * - maximum
- * - expected validation result
- * - array of test input values
- */
- $valuesExpected = [
- [100, true, [-1, 0, 0.01, 1, 99.999]],
- [100, false, [100, 100.0, 100.01]],
- ['a', false, ['a', 'b', 'c', 'd']],
- ['z', true, ['x', 'y']],
- [['max' => 100, 'inclusive' => true], true, [-1, 0, 0.01, 1, 99.999, 100, 100.0]],
- [['max' => 100, 'inclusive' => true], false, [100.01]],
- [['max' => 100, 'inclusive' => false], true, [-1, 0, 0.01, 1, 99.999]],
- [['max' => 100, 'inclusive' => false], false, [100, 100.0, 100.01]],
- ];
-
- foreach ($valuesExpected as $element) {
- $validator = new LessThan($element[0]);
- foreach ($element[2] as $input) {
- $this->assertEquals($element[1], $validator->isValid($input));
- }
+ $validator = new LessThan(...$options);
+ $this->assertSame($expected, $validator->isValid($input));
}
+
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'valid; non inclusive; 100 > -1' => [[100], -1, true],
+ 'valid; non inclusive; 100 > 0' => [[100], 0, true],
+ 'valid; non inclusive; 100 > 0.01' => [[100], 0.01, true],
+ 'valid; non inclusive; 100 > 1' => [[100], 1, true],
+ 'valid; non inclusive; 100 > 99.999' => [[100], 99.999, true],
+
+ 'invalid; non inclusive; 100 <= 100' => [[100], 100, false],
+ 'invalid; non inclusive; 100 <= 100.0' => [[100], 100.0, false],
+ 'invalid; non inclusive; 100 <= 100.01' => [[100], 100.01, false],
+
+ 'valid; inclusive; 100 >= -1' => [[100, true], -1, true],
+ 'valid; inclusive; 100 >= 0' => [[100, true], 0, true],
+ 'valid; inclusive; 100 >= 0.01' => [[100, true], 0.01, true],
+ 'valid; inclusive; 100 >= 1' => [[100, true], 1, true],
+ 'valid; inclusive; 100 >= 99.999' => [[100, true], 99.999, true],
+ 'valid; inclusive; 100 >= 100' => [[100, true], 100, true],
+ 'valid; inclusive; 100 >= 100.0' => [[100, true], 100.0, true],
+
+ 'invalid; inclusive; 100 < 100.01' => [[100, true], 100.01, false],
+
+ 'invalid; non inclusive; a >= a' => [['a'], 'a', false],
+ 'invalid; non inclusive; a >= b' => [['a'], 'b', false],
+ 'invalid; non inclusive; a >= c' => [['a'], 'c', false],
+ 'invalid; non inclusive; a >= d' => [['a'], 'd', false],
+
+ 'valid; inclusive; a <= a' => [['a', true], 'a', true],
+
+ 'valid; non inclusive; z > x' => [['z'], 'x', true],
+ 'valid; non inclusive; z > y' => [['z'], 'y', true],
+
+ 'valid; inclusive; z >= x' => [['z', true], 'x', true],
+ 'valid; inclusive; z >= y' => [['z', true], 'y', true],
+ 'valid; inclusive; z >= z' => [['z', true], 'z', true],
+
+ 'valid; inclusive; 100 >= -1; array' => [[['max' => 100, 'inclusive' => true]], -1, true],
+ 'valid; inclusive; 100 >= 0; array' => [[['max' => 100, 'inclusive' => true]], 0, true],
+ 'valid; inclusive; 100 >= 0.01; array' => [[['max' => 100, 'inclusive' => true]], 0.01, true],
+ 'valid; inclusive; 100 >= 1; array' => [[['max' => 100, 'inclusive' => true]], 1, true],
+ 'valid; inclusive; 100 >= 99.999; array' => [[['max' => 100, 'inclusive' => true]], 99.999, true],
+ 'valid; inclusive; 100 >= 100; array' => [[['max' => 100, 'inclusive' => true]], 100, true],
+ 'valid; inclusive; 100 >= 100.0; array' => [[['max' => 100, 'inclusive' => true]], 100.0, true],
+
+ 'invalid; inclusive; 100 < 100.01; array' => [[['max' => 100, 'inclusive' => true]], 100.01, false],
+
+ 'valid; non inclusive; 100 > -1; array' => [[['max' => 100, 'inclusive' => false]], -1, true],
+ 'valid; non inclusive; 100 > 0; array' => [[['max' => 100, 'inclusive' => false]], 0, true],
+ 'valid; non inclusive; 100 > 0.01; array' => [[['max' => 100, 'inclusive' => false]], 0.01, true],
+ 'valid; non inclusive; 100 > 1; array' => [[['max' => 100, 'inclusive' => false]], 1, true],
+ 'valid; non inclusive; 100 > 99.999; array' => [[['max' => 100, 'inclusive' => false]], 99.999, true],
+
+ 'invalid; non inclusive; 100 <= 100; array' => [[['max' => 100, 'inclusive' => false]], 100, false],
+ 'invalid; non inclusive; 100 <= 100.0; array' => [[['max' => 100, 'inclusive' => false]], 100.0, false],
+ 'invalid; non inclusive; 100 <= 100.01; array' => [[['max' => 100, 'inclusive' => false]], 100.01, false],
+ // phpcs:enable
+ ];
}
/**

MODIFY
test/RegexTest.php
test/RegexTest.php
@@ -21,27 +21,36 @@ class RegexTest extends TestCase
/**
* Ensures that the validator follows expected behavior
*
+ * @dataProvider basicDataProvider
* @return void
*/
- public function testBasic()
+ public function testBasic(array $options, string $input, bool $expected)
{
- /**
- * The elements of each array are, in order:
- * - pattern
- * - expected validation result
- * - array of test input values
- */
- $valuesExpected = [
- ['/[a-z]/', true, ['abc123', 'foo', 'a', 'z']],
- ['/[a-z]/', false, ['123', 'A']],
- ];
-
- foreach ($valuesExpected as $element) {
- $validator = new Regex($element[0]);
- foreach ($element[2] as $input) {
- $this->assertEquals($element[1], $validator->isValid($input));
- }
+ $validator = new Regex(...$options);
+ $this->assertSame($expected, $validator->isValid($input));
}
+
+ public function basicDataProvider()
+ {
+ return [
+ // phpcs:disable
+ 'valid; abc123' => [['/[a-z]/'], 'abc123', true],
+ 'valid; foo' => [['/[a-z]/'], 'foo', true],
+ 'valid; a' => [['/[a-z]/'], 'a', true],
+ 'valid; z' => [['/[a-z]/'], 'z', true],
+
+ 'valid; 123' => [['/[a-z]/'], '123', false],
+ 'valid; A' => [['/[a-z]/'], 'A', false],
+
+ 'valid; abc123; array' => [[['pattern' => '/[a-z]/']], 'abc123', true],
+ 'valid; foo; array' => [[['pattern' => '/[a-z]/']], 'foo', true],
+ 'valid; a; array' => [[['pattern' => '/[a-z]/']], 'a', true],
+ 'valid; z; array' => [[['pattern' => '/[a-z]/']], 'z', true],
+
+ 'valid; 123; array' => [[['pattern' => '/[a-z]/']], '123', false],
+ 'valid; A; array' => [[['pattern' => '/[a-z]/']], 'A', false],
+ // phpcs:enable
+ ];
}
/**

qa: Replace array by data providers in unit tests

Signed-off-by: codisart <louis.celier@gmail.com>