Skip to content

Commit

Permalink
Static tests for the extension via Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
elevinskii committed Mar 5, 2024
1 parent d6655bf commit 9ed26c9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Static Tests
on: [push]

jobs:
coding-standards:
name: Coding Standards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: extdn/github-actions-m2/magento-coding-standard/8.1@master

static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: extdn/github-actions-m2/magento-coding-standard/8.1@master
3 changes: 3 additions & 0 deletions Model/Gallery/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function getCatalogPath(): string
*/
public function getPathInfo(): PathInfo
{
// phpcs:ignore
$pathInfo = pathinfo($this->getAbsolutePath());

return $this->pathInfoFactory->create()
Expand All @@ -76,6 +77,7 @@ public function getFileSize(): int
{
$absolutePath = $this->getAbsolutePath();

// phpcs:ignore
$fileSize = @filesize($absolutePath);
if (!$fileSize) {
throw new FileSystemException(
Expand All @@ -98,6 +100,7 @@ public function getHash(): string

$hash = $this->hashCache->get($absolutePath);
if (!$hash) {
// phpcs:ignore
$hash = @hash_file(self::HASH_ALGORITHM, $absolutePath) ?: null;
$this->hashCache->set($absolutePath, $hash);
}
Expand Down
2 changes: 2 additions & 0 deletions Model/Gallery/Image/HashCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function get(string $path): ?string
/**
* Set file hash by path
*
* @param string $path
* @param string|null $hash
* @return $this
*/
public function set(string $path, ?string $hash): self
Expand Down

0 comments on commit 9ed26c9

Please sign in to comment.