Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rogervila committed Nov 6, 2023
1 parent 2b5df0e commit 592b3ba
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ jobs:
- name: PHP Version
run: php --version

- name: Execute static analysis tests
if: matrix.php-versions == '8.2'
run: composer test-static

# Code quality
- name: Execute tests (Unit and Feature tests) via PHPUnit
# Set environment
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
"fix": [
"@php ./vendor/bin/php-cs-fixer fix --allow-risky=yes"
],
"test-static": [
"@php ./vendor/bin/php-cs-fixer check --allow-risky=yes"
],
"test": [
"@php ./vendor/bin/php-cs-fixer check --allow-risky=yes",
"@php ./vendor/bin/phpunit --testdox"
]
}
Expand Down
5 changes: 3 additions & 2 deletions src/Sermepa/Tpv/Tpv.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function setSumtotal($sumTotal)
*/
public function setChargeExpiryDate($date)
{
if (! $this->isValidDate($date)) {
if (!$this->isValidDate($date)) {
throw new TpvException('Date is not valid.');
}

Expand Down Expand Up @@ -517,7 +517,8 @@ public function getEnvironment()
* @param string $version JavaScript file version: 2 or 3.
* @return string JavaScript file path.
*/
public static function getJsPath($environment = 'test', $version = '2'){
public static function getJsPath($environment = 'test', $version = '2')
{

// Stores the array of JavaScript file paths.
static $jsPaths = [
Expand Down
6 changes: 3 additions & 3 deletions tests/TpvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,15 @@ public function jsPathProvider()
* @test
* @dataProvider jsPathProvider
*/
public function should_return_the_correct_js_path($environment, $version, $expectedPath)
public function should_return_the_correct_js_path($environment, $version, $expectedPath): void
{
$redsys = new Tpv();
$actualPath = $redsys->getJsPath($environment, $version);

$this->assertEquals($expectedPath, $actualPath);
}

public function invalidEnvironmentVersionPathJs()
public static function invalidEnvironmentVersionPathJs()
{
return [
['test', '1'],
Expand All @@ -633,7 +633,7 @@ public function invalidEnvironmentVersionPathJs()
* @test
* @dataProvider invalidEnvironmentVersionPathJs
*/
public function throw_when_set_environment_or_version_is_invalid($environment, $version)
public function throw_when_set_environment_or_version_is_invalid($environment, $version): void
{
$this->expectExceptionMessage("Invalid environment or version");
$this->expectException(\Sermepa\Tpv\TpvException::class);
Expand Down

0 comments on commit 592b3ba

Please sign in to comment.