Skip to content

Commit

Permalink
Merge pull request #146 from Yoast/JRF/whip_requirement-stablize-inte…
Browse files Browse the repository at this point in the history
…rface

Whip_Requirement: be explicit about all expected methods
  • Loading branch information
enricobattocchi authored Oct 2, 2023
2 parents 0b30c05 + ba6e94f commit 68f867b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/interfaces/Whip_Requirement.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,18 @@ interface Whip_Requirement {
* @return string The component name.
*/
public function component();

/**
* Gets the components version defined for the requirement.
*
* @return string
*/
public function version();

/**
* Gets the operator to use when comparing version numbers.
*
* @return string The comparison operator.
*/
public function operator();
}
8 changes: 4 additions & 4 deletions tests/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testItThrowsAnErrorIfAFaultyConfigurationIsPassed() {
public function testItReturnsANegativeNumberIfRequirementCannotBeFound() {
$configuration = new Whip_Configuration( array( 'php' => '5.6' ) );
$requirement = $this->getMockBuilder( 'Whip_Requirement' )
->setMethods( array( 'component' ) )
->setMethods( array( 'component', 'version', 'operator' ) )
->getMock();

$requirement
Expand All @@ -54,7 +54,7 @@ public function testItReturnsANegativeNumberIfRequirementCannotBeFound() {
public function testItReturnsAnEntryIfRequirementIsFound() {
$configuration = new Whip_Configuration( array( 'php' => '5.6' ) );
$requirement = $this->getMockBuilder( 'Whip_Requirement' )
->setMethods( array( 'component' ) )
->setMethods( array( 'component', 'version', 'operator' ) )
->getMock();

$requirement
Expand All @@ -75,7 +75,7 @@ public function testItReturnsAnEntryIfRequirementIsFound() {
public function testIfRequirementIsConfigured() {
$configuration = new Whip_Configuration( array( 'php' => '5.6' ) );
$requirement = $this->getMockBuilder( 'Whip_Requirement' )
->setMethods( array( 'component' ) )
->setMethods( array( 'component', 'version', 'operator' ) )
->getMock();

$requirement
Expand All @@ -84,7 +84,7 @@ public function testIfRequirementIsConfigured() {
->will( $this->returnValue( 'php' ) );

$falseRequirement = $this->getMockBuilder( 'Whip_Requirement' )
->setMethods( array( 'component' ) )
->setMethods( array( 'component', 'version', 'operator' ) )
->getMock();

$falseRequirement
Expand Down

0 comments on commit 68f867b

Please sign in to comment.