Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 1.54 KB

Base-test-case.md

File metadata and controls

63 lines (49 loc) · 1.54 KB

Meritoo Common Library

Common and useful classes, methods, exceptions etc.

Base test case (with common methods and data providers)

Located here: Meritoo\Common\Test\Base\BaseTestCase.

Usage
  1. Just extend the BaseTestCase class or implement Meritoo\Common\Traits\Test\Base\BaseTestCaseTrait trait.
  2. Use one of available data providers, e.g. @dataProvider provideEmptyValue, or asserts, e.g. static::assertMethodVisibility($method, $visibilityType);
Examples
class DateTest extends BaseTestCase
{
    /**
     * @param mixed $value Empty value, e.g. ""
     * @dataProvider provideEmptyValue
     */
    public function testGetDateTimeEmptyValue($value)
    {
        self::assertFalse(Date::getDateTime($value));
    }

	(...)
}
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));
    }

	(...)
}

More

  1. Base test case (with common methods and data providers)
  2. Collection of elements
  3. Templates
  4. Exceptions
  5. Static methods
    1. Arrays
    2. Regex
    3. Uri
  6. Value Objects

‹ Back to Readme