mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
composer.json - move tests-related classes to "autoload-dev" section (used for development purposes only and avoid polluting the autoloader in production)
This commit is contained in:
61
tests/Utilities/GeneratorUtilityTest.php
Normal file
61
tests/Utilities/GeneratorUtilityTest.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\GeneratorUtility;
|
||||
|
||||
/**
|
||||
* Test case of the useful methods for the Generator class
|
||||
*
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class GeneratorUtilityTest extends BaseTestCase
|
||||
{
|
||||
public function verifyConstructor()
|
||||
{
|
||||
static::assertHasNoConstructor(GeneratorUtility::class);
|
||||
}
|
||||
|
||||
public function testGetGeneratorElements()
|
||||
{
|
||||
/*
|
||||
* Generator that provides boolean value
|
||||
*/
|
||||
$elements = [
|
||||
[false],
|
||||
[true],
|
||||
];
|
||||
|
||||
$generator = $this->provideBooleanValue();
|
||||
self::assertEquals($elements, GeneratorUtility::getGeneratorElements($generator));
|
||||
|
||||
$elements = [
|
||||
[''],
|
||||
[' '],
|
||||
[null],
|
||||
[0],
|
||||
[false],
|
||||
[[]],
|
||||
];
|
||||
|
||||
/*
|
||||
* Generator that provides an empty value
|
||||
*/
|
||||
$generator = $this->provideEmptyValue();
|
||||
self::assertEquals($elements, GeneratorUtility::getGeneratorElements($generator));
|
||||
|
||||
/*
|
||||
* Generator that provides instance of DateTime class
|
||||
*/
|
||||
$generator = $this->provideDateTimeInstance();
|
||||
self::assertCount(4, GeneratorUtility::getGeneratorElements($generator));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user