Reformat code automatically

This commit is contained in:
Meritoo
2022-02-12 14:46:47 +01:00
parent a3af138f0c
commit a3adae50b8
116 changed files with 19152 additions and 19091 deletions

View File

@@ -19,10 +19,33 @@ use Meritoo\Common\Type\OopVisibilityType;
* @copyright Meritoo <http://www.meritoo.pl>
*
* @internal
* @covers \Meritoo\Common\Exception\ValueObject\InvalidSizeDimensionsException
* @covers \Meritoo\Common\Exception\ValueObject\InvalidSizeDimensionsException
*/
class InvalidSizeDimensionsExceptionTest extends BaseTestCase
{
public function provideWidthAndHeight()
{
$template = 'Dimensions of size should be positive, but they are not: %d, %d. Is there everything ok?';
yield [
0,
0,
sprintf($template, 0, 0),
];
yield [
-1,
-1,
sprintf($template, -1, -1),
];
yield [
200,
100,
sprintf($template, 200, 100),
];
}
public function testConstructorVisibilityAndArguments()
{
static::assertConstructorVisibilityAndArguments(
@@ -44,27 +67,4 @@ class InvalidSizeDimensionsExceptionTest extends BaseTestCase
$exception = InvalidSizeDimensionsException::create($width, $height);
static::assertSame($expectedMessage, $exception->getMessage());
}
public function provideWidthAndHeight()
{
$template = 'Dimensions of size should be positive, but they are not: %d, %d. Is there everything ok?';
yield[
0,
0,
sprintf($template, 0, 0),
];
yield[
-1,
-1,
sprintf($template, -1, -1),
];
yield[
200,
100,
sprintf($template, 200, 100),
];
}
}

View File

@@ -24,6 +24,29 @@ use Meritoo\Common\Type\OopVisibilityType;
*/
class InvalidContentExceptionTest extends BaseTestCase
{
public function provideContent(): ?Generator
{
$template = 'Content of template \'%s\' is invalid. Did you use string with 1 placeholder at least?';
yield [
'An empty string',
'',
sprintf($template, ''),
];
yield [
'Simple string',
'Lorem ipsum',
sprintf($template, 'Lorem ipsum'),
];
yield [
'One sentence',
'Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.',
sprintf($template, 'Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.'),
];
}
public function testConstructorVisibilityAndArguments(): void
{
static::assertConstructorVisibilityAndArguments(
@@ -45,27 +68,4 @@ class InvalidContentExceptionTest extends BaseTestCase
$exception = InvalidContentException::create($content);
static::assertSame($expectedMessage, $exception->getMessage(), $description);
}
public function provideContent(): ?Generator
{
$template = 'Content of template \'%s\' is invalid. Did you use string with 1 placeholder at least?';
yield[
'An empty string',
'',
sprintf($template, ''),
];
yield[
'Simple string',
'Lorem ipsum',
sprintf($template, 'Lorem ipsum'),
];
yield[
'One sentence',
'Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.',
sprintf($template, 'Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.'),
];
}
}

View File

@@ -8,6 +8,7 @@
namespace Meritoo\Test\Common\Exception\ValueObject\Template;
use Generator;
use Meritoo\Common\Exception\ValueObject\Template\MissingPlaceholdersInValuesException;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Type\OopVisibilityType;
@@ -23,6 +24,39 @@ use Meritoo\Common\Type\OopVisibilityType;
*/
class MissingPlaceholdersInValuesExceptionTest extends BaseTestCase
{
public function provideContentAndMissingPlaceholders(): ?Generator
{
$template = 'Cannot fill template \'%s\', because of missing values for placeholder(s): %s. Did you provide all'
.' required values?';
yield [
'Missing 2nd placeholder',
'%test1% - %test2%',
[
'test2',
],
sprintf(
$template,
'%test1% - %test2%',
'test2'
),
];
yield [
'Missing 2nd and 3rd placeholder',
'%test1% / %test2% / %test3%',
[
'test2',
'test3',
],
sprintf(
$template,
'%test1% / %test2% / %test3%',
'test2, test3'
),
];
}
public function testConstructorVisibilityAndArguments(): void
{
static::assertConstructorVisibilityAndArguments(
@@ -49,37 +83,4 @@ class MissingPlaceholdersInValuesExceptionTest extends BaseTestCase
$exception = MissingPlaceholdersInValuesException::create($content, $missingPlaceholders);
static::assertSame($expectedMessage, $exception->getMessage(), $description);
}
public function provideContentAndMissingPlaceholders(): ?\Generator
{
$template = 'Cannot fill template \'%s\', because of missing values for placeholder(s): %s. Did you provide all'
. ' required values?';
yield[
'Missing 2nd placeholder',
'%test1% - %test2%',
[
'test2',
],
sprintf(
$template,
'%test1% - %test2%',
'test2'
),
];
yield[
'Missing 2nd and 3rd placeholder',
'%test1% / %test2% / %test3%',
[
'test2',
'test3',
],
sprintf(
$template,
'%test1% / %test2% / %test3%',
'test2, test3'
),
];
}
}

View File

@@ -24,6 +24,29 @@ use Meritoo\Common\Type\OopVisibilityType;
*/
class TemplateNotFoundExceptionTest extends BaseTestCase
{
public function provideIndexAndException(): ?Generator
{
$template = 'Template with \'%s\' index was not found. Did you provide all required templates?';
yield [
'An empty string',
'',
new TemplateNotFoundException(sprintf($template, '')),
];
yield [
'Non-empty string',
'test',
new TemplateNotFoundException(sprintf($template, 'test')),
];
yield [
'Integer',
'2',
new TemplateNotFoundException(sprintf($template, 2)),
];
}
public function testConstructor(): void
{
static::assertConstructorVisibilityAndArguments(
@@ -45,27 +68,4 @@ class TemplateNotFoundExceptionTest extends BaseTestCase
$created = TemplateNotFoundException::create($index);
static::assertEquals($expected, $created, $description);
}
public function provideIndexAndException(): ?Generator
{
$template = 'Template with \'%s\' index was not found. Did you provide all required templates?';
yield[
'An empty string',
'',
new TemplateNotFoundException(sprintf($template, '')),
];
yield[
'Non-empty string',
'test',
new TemplateNotFoundException(sprintf($template, 'test')),
];
yield[
'Integer',
'2',
new TemplateNotFoundException(sprintf($template, 2)),
];
}
}