-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from tr33m4n/feature/explicit-config-functions
Make module more testable
- Loading branch information
Showing
22 changed files
with
724 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Codeception\Module\Percy; | ||
|
||
class CleanSnapshots | ||
{ | ||
private ConfigManagement $configManagement; | ||
|
||
/** | ||
* SnapshotManagement constructor. | ||
* | ||
* @param \Codeception\Module\Percy\ConfigManagement $configManagement | ||
*/ | ||
public function __construct( | ||
ConfigManagement $configManagement | ||
) { | ||
$this->configManagement = $configManagement; | ||
} | ||
|
||
/** | ||
* Clean snapshot directory | ||
*/ | ||
public function execute(): void | ||
{ | ||
if (!$this->configManagement->shouldCleanSnapshotStorage()) { | ||
return; | ||
} | ||
|
||
foreach (glob(codecept_output_dir(sprintf(CreateSnapshot::OUTPUT_FILE_PATTERN, '*'))) ?: [] as $snapshotFile) { | ||
unlink($snapshotFile); | ||
} | ||
} | ||
} |
Oops, something went wrong.