Skip to content

Commit

Permalink
Add options to path case
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Jun 27, 2021
1 parent c9e1669 commit 38f3093
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ChangeCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ public function pascalCase(string $string, array $opt = []): string
*
* @return string
*/
public function pathCase(string $string): string
public function pathCase(string $string, array $opt = []): string
{
return $this->noCase($string, ['delimiter' => '/']);
return $this->noCase($string, $opt += ['delimiter' => '/']);
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/ChangeCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ public function pathCase($expected, $actual)
$this->assertSame($expected, $this->cc->pathCase($actual));
}

/** @test */
public function pathCaseWithOpt()
{
$options = ['separateNumber' => true];

$this->assertSame(
'test/v/2',
$this->cc->pathCase('TestV2', $options)
);
$this->assertSame(
'foo/123/bar',
$this->cc->pathCase('Foo123Bar', $options)
);
}

/**
* @test
* @dataProvider sentenceCaseProvider
Expand Down

0 comments on commit 38f3093

Please sign in to comment.