TestCase - make abstract & move from namespace Meritoo\Common\Utilities to Meritoo\Common\Test\Base

This commit is contained in:
Meritoo
2017-09-16 13:31:58 +02:00
parent 324f64f912
commit 5c0ef79b15
11 changed files with 26 additions and 25 deletions

View File

@@ -6,7 +6,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Meritoo\Common\Utilities; namespace Meritoo\Common\Test\Base;
use DateTime; use DateTime;
use Generator; use Generator;
@@ -17,12 +17,12 @@ use ReflectionClass;
use ReflectionMethod; 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> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class TestCase extends PHPUnit_Framework_TestCase abstract class BaseTestCase extends PHPUnit_Framework_TestCase
{ {
/** /**
* Provides an empty value * Provides an empty value
@@ -109,7 +109,7 @@ class TestCase extends PHPUnit_Framework_TestCase
$directoryPath = '/' . $directoryPath; $directoryPath = '/' . $directoryPath;
} }
return sprintf('%s/../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath); return sprintf('%s/../../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath);
} }
/** /**

View File

@@ -10,8 +10,8 @@ namespace Meritoo\Common\Test\Collection;
use ArrayIterator; use ArrayIterator;
use Meritoo\Common\Collection\Collection; use Meritoo\Common\Collection\Collection;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Type\OopVisibilityType; use Meritoo\Common\Type\OopVisibilityType;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the collection of elements * Tests of the collection of elements
@@ -19,7 +19,7 @@ use Meritoo\Common\Utilities\TestCase;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class CollectionTest extends TestCase class CollectionTest extends BaseTestCase
{ {
/** /**
* An empty collection * An empty collection

View File

@@ -8,8 +8,9 @@
namespace Meritoo\Common\Test\Utilities; namespace Meritoo\Common\Test\Utilities;
use Generator;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\Composer; use Meritoo\Common\Utilities\Composer;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the useful Composer-related methods * Tests of the useful Composer-related methods
@@ -17,7 +18,7 @@ use Meritoo\Common\Utilities\TestCase;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright 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 * 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 * Provides names and values of existing nodes
* *
* @return \Generator * @return Generator
*/ */
public function getExistingNode() public function getExistingNode()
{ {

View File

@@ -10,9 +10,9 @@ namespace Meritoo\Common\Test\Utilities;
use DateTime; use DateTime;
use Generator; use Generator;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Type\OopVisibilityType; use Meritoo\Common\Type\OopVisibilityType;
use Meritoo\Common\Utilities\DatePeriod; use Meritoo\Common\Utilities\DatePeriod;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of date's period * Tests of date's period
@@ -20,7 +20,7 @@ use Meritoo\Common\Utilities\TestCase;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class DatePeriodTest extends TestCase class DatePeriodTest extends BaseTestCase
{ {
public function testConstructorVisibilityAndArguments() public function testConstructorVisibilityAndArguments()
{ {

View File

@@ -12,8 +12,8 @@ use DateInterval;
use DateTime; use DateTime;
use Generator; use Generator;
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException; use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\Date; use Meritoo\Common\Utilities\Date;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the Date methods (only static functions) * Tests of the Date methods (only static functions)
@@ -21,7 +21,7 @@ use Meritoo\Common\Utilities\TestCase;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class DateTest extends TestCase class DateTest extends BaseTestCase
{ {
/** /**
* @param mixed $value Empty value, e.g. "" * @param mixed $value Empty value, e.g. ""

View File

@@ -8,8 +8,8 @@
namespace Meritoo\Common\Test\Utilities; namespace Meritoo\Common\Test\Utilities;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\GeneratorUtility; use Meritoo\Common\Utilities\GeneratorUtility;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the useful methods for the Generator class * 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> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class GeneratorUtilityTest extends TestCase class GeneratorUtilityTest extends BaseTestCase
{ {
public function testGetGeneratorElements() public function testGetGeneratorElements()
{ {

View File

@@ -9,8 +9,8 @@
namespace Meritoo\Common\Test\Utilities; namespace Meritoo\Common\Test\Utilities;
use Generator; use Generator;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\Locale; use Meritoo\Common\Utilities\Locale;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the useful locale methods * Tests of the useful locale methods
@@ -18,7 +18,7 @@ use Meritoo\Common\Utilities\TestCase;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class LocaleTest extends TestCase class LocaleTest extends BaseTestCase
{ {
/** /**
* @param mixed $languageCode Empty value, e.g. "" * @param mixed $languageCode Empty value, e.g. ""

View File

@@ -9,8 +9,8 @@
namespace Meritoo\Common\Test\Utilities; namespace Meritoo\Common\Test\Utilities;
use Generator; use Generator;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\MimeTypes; use Meritoo\Common\Utilities\MimeTypes;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the useful methods for mime types of files * 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> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class MimeTypesTest extends TestCase class MimeTypesTest extends BaseTestCase
{ {
/** /**
* @param mixed $mimeType Empty value, e.g. "" * @param mixed $mimeType Empty value, e.g. ""

View File

@@ -11,9 +11,9 @@ namespace Meritoo\Common\Test\Utilities;
use Generator; use Generator;
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException; use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException; use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\Locale; use Meritoo\Common\Utilities\Locale;
use Meritoo\Common\Utilities\Miscellaneous; use Meritoo\Common\Utilities\Miscellaneous;
use Meritoo\Common\Utilities\TestCase;
use stdClass; use stdClass;
/** /**
@@ -22,7 +22,7 @@ use stdClass;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class MiscellaneousTest extends TestCase class MiscellaneousTest extends BaseTestCase
{ {
private $stringSmall; private $stringSmall;
private $stringCommaSeparated; private $stringCommaSeparated;

View File

@@ -13,13 +13,13 @@ use Generator;
use Meritoo\Common\Exception\Reflection\CannotResolveClassNameException; use Meritoo\Common\Exception\Reflection\CannotResolveClassNameException;
use Meritoo\Common\Exception\Reflection\MissingChildClassesException; use Meritoo\Common\Exception\Reflection\MissingChildClassesException;
use Meritoo\Common\Exception\Reflection\TooManyChildClassesException; use Meritoo\Common\Exception\Reflection\TooManyChildClassesException;
use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Test\Utilities\Reflection\A; use Meritoo\Common\Test\Utilities\Reflection\A;
use Meritoo\Common\Test\Utilities\Reflection\B; use Meritoo\Common\Test\Utilities\Reflection\B;
use Meritoo\Common\Test\Utilities\Reflection\C; use Meritoo\Common\Test\Utilities\Reflection\C;
use Meritoo\Common\Test\Utilities\Reflection\D; use Meritoo\Common\Test\Utilities\Reflection\D;
use Meritoo\Common\Test\Utilities\Reflection\E; use Meritoo\Common\Test\Utilities\Reflection\E;
use Meritoo\Common\Utilities\Reflection; use Meritoo\Common\Utilities\Reflection;
use Meritoo\Common\Utilities\TestCase;
/** /**
* Tests of the useful reflection methods * Tests of the useful reflection methods
@@ -27,7 +27,7 @@ use Meritoo\Common\Utilities\TestCase;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class ReflectionTest extends TestCase class ReflectionTest extends BaseTestCase
{ {
/** /**
* @param mixed $invalidClass Empty value, e.g. "" * @param mixed $invalidClass Empty value, e.g. ""

View File

@@ -8,7 +8,7 @@
namespace Meritoo\Common\Test\Utilities; namespace Meritoo\Common\Test\Utilities;
use Meritoo\Common\Utilities\TestCase; use Meritoo\Common\Test\Base\BaseTestCase;
use Meritoo\Common\Utilities\Uri; use Meritoo\Common\Utilities\Uri;
/** /**
@@ -17,7 +17,7 @@ use Meritoo\Common\Utilities\Uri;
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl> * @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl * @copyright Meritoo.pl
*/ */
class UriTest extends TestCase class UriTest extends BaseTestCase
{ {
public function testAddProtocolToUrl() public function testAddProtocolToUrl()
{ {