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 ee10f9a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Coding Standards
on: [push]

jobs:
static:
name: Coding Standards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: extdn/github-actions-m2/magento-coding-standard/8.1@master
10 changes: 10 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Static Analysis
on: [push]

jobs:
static:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: extdn/github-actions-m2/magento-phpstan/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 ee10f9a

Please sign in to comment.