Skip to content

Drop ValueFormatterTestBase::getFormatterClass #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Interfaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
return 1;
}

define( 'DATAVALUES_INTERFACES_VERSION', '0.1.5' );
define( 'DATAVALUES_INTERFACES_VERSION', '0.2.0 alpha' );

/**
* @deprecated
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ as [Wikimedia Germany](https://wikimedia.de) employee for the [Wikidata project]

## Release notes

### 0.2.0 (alpha)

* Dropped `ValueFormatterTestBase::getFormatterClass`
* Made `ValueFormatterTestBase::getInstance` abstract

### 0.1.5 (2015-02-14)

* The options in the `ValueFormatterBase` constructor are now optional
Expand Down
22 changes: 3 additions & 19 deletions tests/ValueFormatters/ValueFormatterTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,14 @@ abstract class ValueFormatterTestBase extends \PHPUnit_Framework_TestCase {
*/
public abstract function validProvider();

/**
* Returns the name of the ValueFormatter implementing class.
*
* @since 0.1
*
* @return string
*/
protected abstract function getFormatterClass();

/**
* @since 0.1
*
* @param FormatterOptions $options
* @param FormatterOptions|null $options
*
* @return ValueFormatter
*/
protected function getInstance( FormatterOptions $options ) {
$class = $this->getFormatterClass();
return new $class( $options );
}
protected abstract function getInstance( FormatterOptions $options = null );

/**
* @dataProvider validProvider
Expand All @@ -59,11 +47,7 @@ protected function getInstance( FormatterOptions $options ) {
* @param ValueFormatter|null $formatter
*/
public function testValidFormat( $value, $expected, FormatterOptions $options = null, ValueFormatter $formatter = null ) {
if ( $options === null ) {
$options = new FormatterOptions();
}

if ( is_null( $formatter ) ) {
if ( $formatter === null ) {
$formatter = $this->getInstance( $options );
}

Expand Down