mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94a464cb4d | ||
|
|
463ee751b2 | ||
|
|
89af7145f6 | ||
|
|
09c8569938 | ||
|
|
5ab2cd9de8 | ||
|
|
60eff29e82 | ||
|
|
5aa5ff4380 | ||
|
|
6483a8f5b7 | ||
|
|
5c0ef79b15 | ||
|
|
324f64f912 | ||
|
|
5940ebba9a |
1
.styleci.yml
Normal file
1
.styleci.yml
Normal file
@@ -0,0 +1 @@
|
||||
preset: symfony
|
||||
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
|
||||
install:
|
||||
- composer install
|
||||
|
||||
script:
|
||||
- php ./vendor/bin/phpunit
|
||||
88
README.md
88
README.md
@@ -1,4 +1,4 @@
|
||||
# Meritoo Common Library
|
||||
# Meritoo Common Library [](https://travis-ci.org/meritoo/common-library) [](https://packagist.org/packages/meritoo/common-library) [](https://styleci.io/repos/101790028) [](https://github.com/meritoo/common-library) [](https://github.com/meritoo/common-library) [](https://coveralls.io/github/meritoo/common-library?branch=master)
|
||||
Useful classes, methods, extensions etc.
|
||||
|
||||
## Installation
|
||||
@@ -11,15 +11,93 @@ Run [Composer](https://getcomposer.org) to install new package:
|
||||
|
||||
> How to install Composer: https://getcomposer.org/download
|
||||
|
||||
## Usage
|
||||
## Static methods
|
||||
|
||||
This package contains a lot of static methods, so usage is not so complicated. Just run the static method who would you like to use. Example:
|
||||
This package contains a lot of class with static methods, so usage is not so complicated. Just run the static method who would you like to use. Example:
|
||||
|
||||
```php
|
||||
use Meritoo\Common\Utilities\Arrays;
|
||||
|
||||
$firstElement = Arrays::getFirstElement(['lorem' 'ipsum']);
|
||||
// result: "lorem"
|
||||
$firstElement = Arrays::getFirstElement(['lorem', 'ipsum']);
|
||||
var_dump($firstElement); // string(5) "lorem"
|
||||
```
|
||||
|
||||
## Base test case with common methods and data providers
|
||||
|
||||
Located here: `Meritoo\Common\Test\Base\BaseTestCase`. Just extend the `BaseTestCase` class and use it like in `Meritoo\Common\Test\Utilities\DateTest` class:
|
||||
|
||||
```php
|
||||
class DateTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @param mixed $value Empty value, e.g. ""
|
||||
* @dataProvider provideEmptyValue
|
||||
*/
|
||||
public function testGetDateTimeEmptyValue($value)
|
||||
{
|
||||
self::assertFalse(Date::getDateTime($value));
|
||||
}
|
||||
|
||||
(...)
|
||||
}
|
||||
```
|
||||
|
||||
or in `Meritoo\Common\Test\Utilities\MimeTypesTest` class:
|
||||
|
||||
```php
|
||||
class MimeTypesTest extends BaseTestCase
|
||||
{
|
||||
(...)
|
||||
|
||||
/**
|
||||
* @param bool $mimeType The mime type, e.g. "video/mpeg"
|
||||
* @dataProvider provideBooleanValue
|
||||
*/
|
||||
public function testGetExtensionBooleanMimeType($mimeType)
|
||||
{
|
||||
self::assertEquals('', MimeTypes::getExtension($mimeType));
|
||||
}
|
||||
|
||||
(...)
|
||||
}
|
||||
```
|
||||
|
||||
## Collection of elements
|
||||
|
||||
Located here: `Meritoo\Common\Collection\Collection`. It's a set of some elements, e.g. objects. It's iterable and countable. Provides very useful methods. Some of them:
|
||||
- `getFirst()` - returns the first element in the collection
|
||||
- `getLast()` - returns the last element in the collection
|
||||
- `isEmpty()` - returns information if collection is empty
|
||||
- `add($element, $index = null)` - adds given element (at the end of collection)
|
||||
- `addMultiple($elements, $useIndexes = false)` - adds given elements (at the end of collection)
|
||||
- `prepend($element)` - prepends given element (adds given element at the beginning of collection)
|
||||
- `remove($element)` - removes given element
|
||||
|
||||
Examples of usage below.
|
||||
|
||||
#### An empty collection
|
||||
|
||||
```php
|
||||
use Meritoo\Common\Collection\Collection;
|
||||
|
||||
$emptyCollection = new Collection();
|
||||
var_dump($emptyCollection->isEmpty()); // bool(true)
|
||||
```
|
||||
|
||||
#### Simple collection
|
||||
|
||||
```php
|
||||
use Meritoo\Common\Collection\Collection;
|
||||
|
||||
$elements = [
|
||||
'lorem',
|
||||
'ipsum',
|
||||
123 => 'dolor',
|
||||
345 => 'sit',
|
||||
];
|
||||
|
||||
$simpleCollection = new Collection($elements);
|
||||
var_dump($simpleCollection->has('dolor')); // bool(true)
|
||||
```
|
||||
|
||||
Enjoy!
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "meritoo/common-library",
|
||||
"description": "Useful classes, methods, extensions etc.",
|
||||
"license": "MIT",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.7",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Meritoo.pl",
|
||||
@@ -28,7 +28,7 @@
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Meritoo\\Common\\": "src/Meritoo/Common/",
|
||||
"Meritoo\\Common\\Tests\\": "tests/Meritoo/Common/Tests/"
|
||||
"Meritoo\\Common\\Test\\": "tests/Meritoo/Common/Test/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
bootstrap="./vendor/autoload.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Meritoo's Common Library Test Suite">
|
||||
<testsuite name="Meritoo Package - Main Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Utilities;
|
||||
namespace Meritoo\Common\Test\Base;
|
||||
|
||||
use DateTime;
|
||||
use Generator;
|
||||
@@ -17,12 +17,12 @@ use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
|
||||
/**
|
||||
* Test case with common methods and data providers
|
||||
* Base test case with common methods and data providers
|
||||
*
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class TestCase extends PHPUnit_Framework_TestCase
|
||||
abstract class BaseTestCase extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Provides an empty value
|
||||
@@ -92,7 +92,7 @@ class TestCase extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
yield['lets-test.doc'];
|
||||
yield['lorem/ipsum.jpg'];
|
||||
yield['suprise/me/one/more/time.txt'];
|
||||
yield['surprise/me/one/more/time.txt'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ class TestCase extends PHPUnit_Framework_TestCase
|
||||
$directoryPath = '/' . $directoryPath;
|
||||
}
|
||||
|
||||
return sprintf('%s/../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath);
|
||||
return sprintf('%s/../../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath);
|
||||
}
|
||||
|
||||
/**
|
||||
60
src/Meritoo/Common/Test/Base/BaseTypeTestCase.php
Normal file
60
src/Meritoo/Common/Test/Base/BaseTypeTestCase.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Meritoo\Common\Test\Base;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Type\Base\BaseType;
|
||||
|
||||
/**
|
||||
* Base test case for the type of something
|
||||
*
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
abstract class BaseTypeTestCase extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Verifies availability of all types
|
||||
*/
|
||||
public function testAvailabilityOfAllTypes()
|
||||
{
|
||||
$available = $this->getTestedTypeInstance()->getAll();
|
||||
$all = $this->getAllExpectedTypes();
|
||||
|
||||
static::assertEquals($all, $available);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies whether given type is correct or not
|
||||
*
|
||||
* @param string $type Type to verify
|
||||
* @param bool $expected Information if given type is correct or not
|
||||
*
|
||||
* @dataProvider provideTypeToVerify
|
||||
*/
|
||||
public function testIfGivenTypeIsCorrect($type, $expected)
|
||||
{
|
||||
static::assertEquals($expected, $this->getTestedTypeInstance()->isCorrectType($type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides type to verify and information if it's correct
|
||||
*
|
||||
* @return Generator
|
||||
*/
|
||||
abstract public function provideTypeToVerify();
|
||||
|
||||
/**
|
||||
* Returns instance of the tested type
|
||||
*
|
||||
* @return BaseType
|
||||
*/
|
||||
abstract protected function getTestedTypeInstance();
|
||||
|
||||
/**
|
||||
* Returns all expected types of the tested type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function getAllExpectedTypes();
|
||||
}
|
||||
@@ -6,12 +6,12 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Collection;
|
||||
namespace Meritoo\Common\Test\Collection;
|
||||
|
||||
use ArrayIterator;
|
||||
use Meritoo\Common\Collection\Collection;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Type\OopVisibilityType;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the collection of elements
|
||||
@@ -19,7 +19,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class CollectionTest extends TestCase
|
||||
class CollectionTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* An empty collection
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Exception\Base;
|
||||
namespace Meritoo\Common\Test\Exception\Base;
|
||||
|
||||
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||
use Meritoo\Common\Type\Base\BaseType;
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Type\Base;
|
||||
namespace Meritoo\Common\Test\Type\Base;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Type\Base\BaseType;
|
||||
@@ -6,11 +6,10 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Type;
|
||||
namespace Meritoo\Common\Test\Type;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Test\Base\BaseTypeTestCase;
|
||||
use Meritoo\Common\Type\DatePartType;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the type of date part, e.g. "year"
|
||||
@@ -18,11 +17,14 @@ use PHPUnit_Framework_TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class DatePartTypeTest extends PHPUnit_Framework_TestCase
|
||||
class DatePartTypeTest extends BaseTypeTestCase
|
||||
{
|
||||
public function testGetAll()
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getAllExpectedTypes()
|
||||
{
|
||||
$expectedTypes = [
|
||||
return [
|
||||
'DAY' => DatePartType::DAY,
|
||||
'HOUR' => DatePartType::HOUR,
|
||||
'MINUTE' => DatePartType::MINUTE,
|
||||
@@ -30,29 +32,20 @@ class DatePartTypeTest extends PHPUnit_Framework_TestCase
|
||||
'SECOND' => DatePartType::SECOND,
|
||||
'YEAR' => DatePartType::YEAR,
|
||||
];
|
||||
|
||||
$all = (new DatePartType())->getAll();
|
||||
self::assertEquals($expectedTypes, $all);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $toVerifyType Concrete type to verify (of given instance of type)
|
||||
* @param bool $isCorrect Expected information if given type is correct
|
||||
*
|
||||
* @dataProvider provideConcreteType
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function testIsCorrectType($toVerifyType, $isCorrect)
|
||||
protected function getTestedTypeInstance()
|
||||
{
|
||||
$type = new DatePartType();
|
||||
self::assertEquals($isCorrect, $type->isCorrectType($toVerifyType));
|
||||
return new DatePartType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides type of something for testing the isCorrectType() method
|
||||
*
|
||||
* @return Generator
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function provideConcreteType()
|
||||
public function provideTypeToVerify()
|
||||
{
|
||||
yield[
|
||||
'',
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Meritoo\Common\Utilities\Arrays;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Meritoo\Common\Utilities\Bundle;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
@@ -6,10 +6,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\Composer;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the useful Composer-related methods
|
||||
@@ -17,7 +18,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class ComposerTest extends TestCase
|
||||
class ComposerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Path of existing composer.json used as source of data for tests
|
||||
@@ -60,7 +61,7 @@ class ComposerTest extends TestCase
|
||||
/**
|
||||
* Provides names and values of existing nodes
|
||||
*
|
||||
* @return \Generator
|
||||
* @return Generator
|
||||
*/
|
||||
public function getExistingNode()
|
||||
{
|
||||
@@ -6,13 +6,13 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use DateTime;
|
||||
use Generator;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Type\OopVisibilityType;
|
||||
use Meritoo\Common\Utilities\DatePeriod;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of date's period
|
||||
@@ -20,7 +20,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class DatePeriodTest extends TestCase
|
||||
class DatePeriodTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
@@ -6,14 +6,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Generator;
|
||||
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\Date;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the Date methods (only static functions)
|
||||
@@ -21,7 +21,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class DateTest extends TestCase
|
||||
class DateTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @param mixed $value Empty value, e.g. ""
|
||||
@@ -454,8 +454,11 @@ class DateTest extends TestCase
|
||||
$start = 1;
|
||||
$end = 100;
|
||||
|
||||
$intervalMinDate = (clone $startDate)->add(new DateInterval(sprintf('P%dD', $start)));
|
||||
$intervalMaxDate = (clone $startDate)->add(new DateInterval(sprintf('P%dD', $end)));
|
||||
$minDate = clone $startDate;
|
||||
$maxDate = clone $startDate;
|
||||
|
||||
$intervalMinDate = $minDate->add(new DateInterval(sprintf('P%dD', $start)));
|
||||
$intervalMaxDate = $maxDate->add(new DateInterval(sprintf('P%dD', $end)));
|
||||
|
||||
$randomDate = Date::getRandomDate();
|
||||
self::assertTrue($randomDate >= $intervalMinDate && $randomDate <= $intervalMaxDate);
|
||||
@@ -471,7 +474,9 @@ class DateTest extends TestCase
|
||||
public function testGetRandomDateIncorrectEnd(DateTime $startDate, $start, $end)
|
||||
{
|
||||
$randomDate = Date::getRandomDate($startDate, $start, $end);
|
||||
$intervalDate = (clone $startDate)->add(new DateInterval(sprintf('P%dD', $start)));
|
||||
|
||||
$cloned = clone $startDate;
|
||||
$intervalDate = $cloned->add(new DateInterval(sprintf('P%dD', $start)));
|
||||
|
||||
self::assertTrue($randomDate >= $intervalDate && $randomDate <= $intervalDate);
|
||||
}
|
||||
@@ -487,8 +492,11 @@ class DateTest extends TestCase
|
||||
{
|
||||
$randomDate = Date::getRandomDate($startDate, $start, $end);
|
||||
|
||||
$intervalMinDate = (clone $startDate)->add(new DateInterval(sprintf('P%dD', $start)));
|
||||
$intervalMaxDate = (clone $startDate)->add(new DateInterval(sprintf('P%dD', $end)));
|
||||
$minDate = clone $startDate;
|
||||
$maxDate = clone $startDate;
|
||||
|
||||
$intervalMinDate = $minDate->add(new DateInterval(sprintf('P%dD', $start)));
|
||||
$intervalMaxDate = $maxDate->add(new DateInterval(sprintf('P%dD', $end)));
|
||||
|
||||
self::assertTrue($randomDate >= $intervalMinDate && $randomDate <= $intervalMaxDate);
|
||||
}
|
||||
@@ -6,10 +6,10 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\GeneratorUtility;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the useful methods for the Generator class
|
||||
@@ -17,7 +17,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class GeneratorUtilityTest extends TestCase
|
||||
class GeneratorUtilityTest extends BaseTestCase
|
||||
{
|
||||
public function testGetGeneratorElements()
|
||||
{
|
||||
@@ -6,11 +6,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\Locale;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the useful locale methods
|
||||
@@ -18,7 +18,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class LocaleTest extends TestCase
|
||||
class LocaleTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @param mixed $languageCode Empty value, e.g. ""
|
||||
@@ -6,11 +6,11 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\MimeTypes;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the useful methods for mime types of files
|
||||
@@ -18,7 +18,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class MimeTypesTest extends TestCase
|
||||
class MimeTypesTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @param mixed $mimeType Empty value, e.g. ""
|
||||
@@ -6,14 +6,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Generator;
|
||||
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
|
||||
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\Locale;
|
||||
use Meritoo\Common\Utilities\Miscellaneous;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,7 @@ use stdClass;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class MiscellaneousTest extends TestCase
|
||||
class MiscellaneousTest extends BaseTestCase
|
||||
{
|
||||
private $stringSmall;
|
||||
private $stringCommaSeparated;
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||
namespace Meritoo\Common\Test\Utilities\Reflection;
|
||||
|
||||
/**
|
||||
* The A class.
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||
namespace Meritoo\Common\Test\Utilities\Reflection;
|
||||
|
||||
/**
|
||||
* The B class.
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||
namespace Meritoo\Common\Test\Utilities\Reflection;
|
||||
|
||||
/**
|
||||
* The C class.
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||
namespace Meritoo\Common\Test\Utilities\Reflection;
|
||||
|
||||
/**
|
||||
* The D class.
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||
namespace Meritoo\Common\Test\Utilities\Reflection;
|
||||
|
||||
/**
|
||||
* The E trait.
|
||||
@@ -6,20 +6,20 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use DateTime;
|
||||
use Generator;
|
||||
use Meritoo\Common\Exception\Reflection\CannotResolveClassNameException;
|
||||
use Meritoo\Common\Exception\Reflection\MissingChildClassesException;
|
||||
use Meritoo\Common\Exception\Reflection\TooManyChildClassesException;
|
||||
use Meritoo\Common\Tests\Utilities\Reflection\A;
|
||||
use Meritoo\Common\Tests\Utilities\Reflection\B;
|
||||
use Meritoo\Common\Tests\Utilities\Reflection\C;
|
||||
use Meritoo\Common\Tests\Utilities\Reflection\D;
|
||||
use Meritoo\Common\Tests\Utilities\Reflection\E;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Test\Utilities\Reflection\A;
|
||||
use Meritoo\Common\Test\Utilities\Reflection\B;
|
||||
use Meritoo\Common\Test\Utilities\Reflection\C;
|
||||
use Meritoo\Common\Test\Utilities\Reflection\D;
|
||||
use Meritoo\Common\Test\Utilities\Reflection\E;
|
||||
use Meritoo\Common\Utilities\Reflection;
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
|
||||
/**
|
||||
* Tests of the useful reflection methods
|
||||
@@ -27,7 +27,7 @@ use Meritoo\Common\Utilities\TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class ReflectionTest extends TestCase
|
||||
class ReflectionTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @param mixed $invalidClass Empty value, e.g. ""
|
||||
@@ -88,7 +88,7 @@ class ReflectionTest extends TestCase
|
||||
/*
|
||||
* Existing class
|
||||
*/
|
||||
self::assertEquals('Meritoo\Common\Tests\Utilities', Reflection::getClassNamespace(self::class));
|
||||
self::assertEquals('Meritoo\Common\Test\Utilities', Reflection::getClassNamespace(self::class));
|
||||
self::assertEquals(DateTime::class, Reflection::getClassNamespace(new DateTime()));
|
||||
|
||||
self::assertEquals(DateTime::class, Reflection::getClassNamespace([
|
||||
@@ -6,9 +6,9 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Meritoo\Common\Utilities\TestCase;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Utilities\Uri;
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ use Meritoo\Common\Utilities\Uri;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class UriTest extends TestCase
|
||||
class UriTest extends BaseTestCase
|
||||
{
|
||||
public function testAddProtocolToUrl()
|
||||
{
|
||||
@@ -6,7 +6,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Meritoo\Common\Tests\Utilities;
|
||||
namespace Meritoo\Common\Test\Utilities;
|
||||
|
||||
use Meritoo\Common\Utilities\Xml;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
Reference in New Issue
Block a user