mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Tests > increase code coverage
This commit is contained in:
@@ -28,6 +28,7 @@ class MiscellaneousTest extends BaseTestCase
|
||||
private $stringSmall;
|
||||
private $stringCommaSeparated;
|
||||
private $stringDotSeparated;
|
||||
private $stringWithoutSpaces;
|
||||
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
@@ -365,6 +366,7 @@ class MiscellaneousTest extends BaseTestCase
|
||||
{
|
||||
self::assertEquals('Lorem ipsum dolor sit<br>amet, consectetur<br>adipiscing<br>elit', Miscellaneous::breakLongText($this->stringCommaSeparated, 20));
|
||||
self::assertEquals('Lorem ipsum dolor sit---amet, consectetur---adipiscing---elit', Miscellaneous::breakLongText($this->stringCommaSeparated, 20, '---'));
|
||||
self::assertEquals('LoremIpsum<br>DolorSitAm<br>etConsecte<br>turAdipisc<br>ingElit', Miscellaneous::breakLongText($this->stringWithoutSpaces, 10));
|
||||
}
|
||||
|
||||
public function testRemoveDirectoryUsingNotExistingDirectory()
|
||||
@@ -768,6 +770,21 @@ class MiscellaneousTest extends BaseTestCase
|
||||
self::assertNotEmpty(Miscellaneous::getProjectRootPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $headerSize Length of HTTP headers in content
|
||||
* @dataProvider provideHeaderSizeForEmptyCurlResponse
|
||||
*/
|
||||
public function testGetCurlResponseWithHeadersUsingEmptyResponse($headerSize)
|
||||
{
|
||||
$expected = [
|
||||
'headers' => [],
|
||||
'cookies' => [],
|
||||
'content' => '',
|
||||
];
|
||||
|
||||
self::assertEquals($expected, Miscellaneous::getCurlResponseWithHeaders('', $headerSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides string to convert characters to latin characters and not lower cased and not human-readable
|
||||
*
|
||||
@@ -1178,6 +1195,30 @@ class MiscellaneousTest extends BaseTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides length/size of HTTP headers for an empty response
|
||||
*
|
||||
* @return Generator
|
||||
*/
|
||||
public function provideHeaderSizeForEmptyCurlResponse()
|
||||
{
|
||||
yield[
|
||||
-10,
|
||||
];
|
||||
|
||||
yield[
|
||||
-1,
|
||||
];
|
||||
|
||||
yield[
|
||||
0,
|
||||
];
|
||||
|
||||
yield[
|
||||
10,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -1188,6 +1229,7 @@ class MiscellaneousTest extends BaseTestCase
|
||||
$this->stringSmall = 'Lorem ipsum dolor sit amet.';
|
||||
$this->stringCommaSeparated = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
|
||||
$this->stringDotSeparated = 'Etiam ullamcorper. Suspendisse a pellentesque dui, non felis.';
|
||||
$this->stringWithoutSpaces = 'LoremIpsumDolorSitAmetConsecteturAdipiscingElit';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1200,5 +1242,6 @@ class MiscellaneousTest extends BaseTestCase
|
||||
unset($this->stringSmall);
|
||||
unset($this->stringCommaSeparated);
|
||||
unset($this->stringDotSeparated);
|
||||
unset($this->stringWithoutSpaces);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user