Skip to content

Commit

Permalink
add test and rearrange logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopheFerreboeuf committed Jan 16, 2025
1 parent 75af2bf commit 9301544
Show file tree
Hide file tree
Showing 24 changed files with 765 additions and 512 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: List files
run: ls -la
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
Expand Down
13 changes: 0 additions & 13 deletions Exception/Processor/Modules/IgnoredModuleException.php

This file was deleted.

219 changes: 0 additions & 219 deletions Processor/Files/Logic/Modules/CheckEnabled.php

This file was deleted.

2 changes: 1 addition & 1 deletion Processor/Type/Logic.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function doProcess(array $processors, array $files, ProgressBar $progr
foreach ($processors as $processor) {
$progressBar?->advance();
if (!$processor instanceof AuditProcessorInterface) {
throw new \InvalidArgumentException('Processor must implement ProcessorInterface');
throw new \InvalidArgumentException('Processor must implement AuditProcessorInterface');
}
if ($processor instanceof ArrayProcessorInterface) {
$processor->setArray($files);
Expand Down
2 changes: 1 addition & 1 deletion Processor/Type/PHPCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function doProcess(array $processors, array $files, ProgressBar $progr
}
foreach ($processors as $processor) {
if (!$processor instanceof AuditProcessorInterface) {
throw new \InvalidArgumentException('Processor must implement ProcessorInterface');
throw new \InvalidArgumentException('Processor must implement AuditProcessorInterface');
}
if ($processor instanceof FileProcessorInterface) {
$processor->setFile($codeFile);
Expand Down
1 change: 0 additions & 1 deletion Service/ModuleTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public function getModuleNameByAnyFile(string $filePath, bool $isVendor = false)
$input = $this->modulePath->getDeclarationXml($filePath, $isVendor);
return $this->getModuleNameByModuleXml($input);
} catch (\InvalidArgumentException $e) {
dump($filePath);
$input = $this->modulePath->getDeclarationXml($filePath, !$isVendor);
return $this->getModuleNameByModuleXml($input);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Crealoz\EasyAudit\Test\Unit\Model;
namespace Crealoz\EasyAudit\Test\Integration\Model;

use Crealoz\EasyAudit\Model\ResourceModel\AuditRequest;

Expand Down Expand Up @@ -71,10 +71,12 @@ public function testGetList()
$searchCriteria = $this->createMock(\Magento\Framework\Api\SearchCriteriaInterface::class);
$searchResult = $this->createMock(\Magento\Framework\Api\SearchResultsInterface::class);
$collection = $this->createMock(\Crealoz\EasyAudit\Model\ResourceModel\AuditRequest\Collection::class);

$this->collectionFactory->expects($this->once())->method('create')->willReturn($collection);
$this->collectionProcessor->expects($this->once())->method('process')->with($searchCriteria, $collection);
$collection->expects($this->once())->method('getSize')->willReturn(1);
$collection->expects($this->once())->method('getItems')->willReturn([$this->createMock(\Crealoz\EasyAudit\Model\AuditRequest::class)]);

$this->searchResultFactory->expects($this->once())->method('create')->willReturn($searchResult);
$this->assertEquals($searchResult, $this->auditRequestRepository->getList($searchCriteria));
}
Expand Down
Loading

0 comments on commit 9301544

Please sign in to comment.