Skip to content

Commit

Permalink
Added test for Compass\Path::getLast method.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinogradsoft committed Dec 2, 2023
1 parent 28f34cf commit 300bbe2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/PathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,29 @@ public function getCasesGet(): array
];
}

/**
* @dataProvider getCasesGetWithSuffix
*/
public function testGetLastWithSuffix($source, $withSuffix, $suffix, $expect)
{
$path = new Path($source);
$path->setSuffix($suffix);
self::assertEquals($expect, $path->getLast($withSuffix));
}

/**
* @return array
*/
public function getCasesGetWithSuffix(): array
{
return [
'standard' => ['/src/Scanner/Driver/File/index.php', true, '.old', 'index.php.old'],
'dot' => ['/src/Scanner/Driver/File/.php', true, '.old', '.php.old'],
'no dot' => ['/src/Scanner/Driver/File/name', true, '.old', 'name.old'],
'empty' => ['/', true, '.old', null],
];
}

public function testReplaceAll()
{
$path = new Path('/s__NAME____NAME__rc/__NAME__Scanner/Driver__NAME__/Fi__NAME2__le/');
Expand Down

0 comments on commit 300bbe2

Please sign in to comment.