Skip to content

Commit

Permalink
I just added new tests for DS_MERCHANT_PAYMETHODS and merge pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheduardo committed Aug 7, 2023
1 parent 45a04ca commit af3eaa8
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tests/TpvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,53 @@ public function set_new_parameters()

}

public function invalidSetMethod()
{
return [
['V'],
['A'],
['X'],
['AA'],
['Np'],
];
}

/**
* @test
* @dataProvider invalidSetMethod
*/
public function throw_when_set_method_is_invalid($method)
{
$this->expectExceptionMessage("Pay method is not valid");
$this->expectException(\Sermepa\Tpv\TpvException::class);
$redsys = new Tpv();
$redsys->setMethod($method);
}

public function methodsProvider()
{
return [
['T'],
['C'],
['R'],
['D'],
['z'],
['p'],
['N']
];
}

/**
*
* @test
* @dataProvider methodsProvider
*/
public function should_validate_a_method($method)
{
$redsys = new Tpv();
$redsys->setMethod($method);
$parameters = $redsys->getParameters();
$this->assertArrayHasKey('DS_MERCHANT_PAYMETHODS', $parameters);
}

}

0 comments on commit af3eaa8

Please sign in to comment.