Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinHassan committed Jun 12, 2020
1 parent 0e24a2b commit 01bdab4
Show file tree
Hide file tree
Showing 47 changed files with 169 additions and 169 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@cs"
],
"cs": "phpcs -s src --standard=PSR12 --extensions=php && phpcs -s test --standard=PSR12 --extensions=php",
"cs-fix": "phpcbf -s src --standard=PSR12 && phpcbf -s src --standard=PSR12",
"cs-fix": "phpcbf -s src --standard=PSR12 && phpcbf -s test --standard=PSR12",
"unit-tests": "phpunit --colors=always",
"unit-tests-coverage": "phpunit --colors=always -v --coverage-text",
"unit-tests-coverage-clover": "phpunit --colors=always -v --coverage-clover ./build/logs/clover.xml"
Expand Down
8 changes: 4 additions & 4 deletions test/Archiver/Csv/Entity/ArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ArchiveTest extends TestCase
{
use ObjectHelper;

public function testIsFileAvailableReturnsTrueIfNotDeletedOrArchived() : void
public function testIsFileAvailableReturnsTrueIfNotDeletedOrArchived(): void
{
$resource = $this->prophesize(AbstractDb::class);
$resource->getIdFieldName()->willReturn('id');
Expand All @@ -26,7 +26,7 @@ public function testIsFileAvailableReturnsTrueIfNotDeletedOrArchived() : void
self::assertTrue($archive->isFileAvailable());
}

public function testIsFileAvailableReturnsFalseIfFileIsArchived() : void
public function testIsFileAvailableReturnsFalseIfFileIsArchived(): void
{
$resource = $this->prophesize(AbstractDb::class);
$resource->getIdFieldName()->willReturn('id');
Expand All @@ -39,7 +39,7 @@ public function testIsFileAvailableReturnsFalseIfFileIsArchived() : void
self::assertFalse($archive->isFileAvailable());
}

public function testIsFileAvailableReturnsFalseIfFileIsDeleted() : void
public function testIsFileAvailableReturnsFalseIfFileIsDeleted(): void
{
$resource = $this->prophesize(AbstractDb::class);
$resource->getIdFieldName()->willReturn('id');
Expand All @@ -52,7 +52,7 @@ public function testIsFileAvailableReturnsFalseIfFileIsDeleted() : void
self::assertFalse($archive->isFileAvailable());
}

public function testIsFileAvailableReturnsFalseIfFileIsDeletedAndArchived() : void
public function testIsFileAvailableReturnsFalseIfFileIsDeletedAndArchived(): void
{
$resource = $this->prophesize(AbstractDb::class);
$resource->getIdFieldName()->willReturn('id');
Expand Down
8 changes: 4 additions & 4 deletions test/Archiver/CsvArchiverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CsvArchiverTest extends TestCase
*/
private $sourceId;

public function setUp() : void
public function setUp(): void
{
$this->tempRoot = sprintf('%s/%s', sys_get_temp_dir(), $this->getName());
@mkdir($this->tempRoot, 0777, true);
Expand All @@ -82,15 +82,15 @@ public function setUp() : void
'failed_directory' => 'jh_import/failed',
]),
$this->directoryList,
new File,
new File(),
$resourceConnection->reveal(),
$this->date
);
}

public function tearDown() : void
public function tearDown(): void
{
(new Filesystem)->remove($this->tempRoot);
(new Filesystem())->remove($this->tempRoot);
}

public function testFailedMovesToFailedFolderAndRenamesFileWithCurrentDate()
Expand Down
24 changes: 12 additions & 12 deletions test/AttributeProcessor/BrandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BrandTest extends TestCase
private $brandProcessor;
private $tempDirectory;

public function setUp() : void
public function setUp(): void
{
if (!class_exists(Brand::class)) {
$this->markTestSkipped('wearejh/m2-module-brands not installed');
Expand All @@ -48,18 +48,18 @@ public function setUp() : void
$this->brandProcessor = new BrandProcessor(
$this->brandFactory->reveal(),
$this->brandRepository->reveal(),
new File,
new File(),
new Filesystem(
new DirectoryList($this->tempDirectory),
new ReadFactory(new DriverPool),
new WriteFactory(new DriverPool)
new ReadFactory(new DriverPool()),
new WriteFactory(new DriverPool())
)
);
}

public function tearDown() : void
public function tearDown(): void
{
(new SymfonyFilesystem)->remove($this->tempDirectory);
(new SymfonyFilesystem())->remove($this->tempDirectory);
}

public function testIfBrandExistsNoNewBrandIsCreated()
Expand All @@ -68,7 +68,7 @@ public function testIfBrandExistsNoNewBrandIsCreated()
$brand->getName()->willReturn('Atom');
$brand->getId()->willReturn(12);

$searchResult = new BrandSearchResult;
$searchResult = new BrandSearchResult();
$searchResult->setItems([$brand->reveal()]);
$this->brandRepository->getList(Argument::type(SearchCriteria::class))->willReturn($searchResult);

Expand All @@ -91,7 +91,7 @@ public function testBrandIsCreatedIfItDoesNotExist()
$brand->getName()->willReturn('Atom');
$brand->getId()->willReturn(12);

$searchResult = new BrandSearchResult;
$searchResult = new BrandSearchResult();
$searchResult->setItems([$brand->reveal()]);
$this->brandRepository->getList(Argument::type(SearchCriteria::class))->willReturn($searchResult);

Expand Down Expand Up @@ -122,7 +122,7 @@ public function testBrandIsOnlyCreatedOnceIfItDoesNotExist()
$brand->getName()->willReturn('Atom');
$brand->getId()->willReturn(12);

$searchResult = new BrandSearchResult;
$searchResult = new BrandSearchResult();
$searchResult->setItems([$brand->reveal()]);
$this->brandRepository->getList(Argument::type(SearchCriteria::class))->willReturn($searchResult);

Expand Down Expand Up @@ -158,7 +158,7 @@ public function testBrandIsOnlyCreatedOnceIfItDoesNotExist()

public function testBrandIsSavedWithoutImageIfImageDoesNotExist()
{
$searchResult = new BrandSearchResult;
$searchResult = new BrandSearchResult();
$searchResult->setItems([]);
$this->brandRepository->getList(Argument::type(SearchCriteria::class))->willReturn($searchResult);

Expand Down Expand Up @@ -191,7 +191,7 @@ public function testBrandIsSavedWithoutImageIfImageWithSameNameAlreadyExists()
mkdir(sprintf('%s/pub/media/catalog/product/brands', $this->tempDirectory), 0777, true);
touch(sprintf('%s/pub/media/catalog/product/brands/my-image.png', $this->tempDirectory));

$searchResult = new BrandSearchResult;
$searchResult = new BrandSearchResult();
$searchResult->setItems([]);
$this->brandRepository->getList(Argument::type(SearchCriteria::class))->willReturn($searchResult);

Expand Down Expand Up @@ -226,7 +226,7 @@ public function testImageIsImportedWithBrandIfOneIsSpecified()
$brand->getName()->willReturn('Atom');
$brand->getId()->willReturn(12);

$searchResult = new BrandSearchResult;
$searchResult = new BrandSearchResult();
$searchResult->setItems([$brand->reveal()]);
$this->brandRepository->getList(Argument::type(SearchCriteria::class))->willReturn($searchResult);

Expand Down
28 changes: 14 additions & 14 deletions test/Block/InfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetImportReturnsConfigFromRequest(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);

Expand Down Expand Up @@ -66,7 +66,7 @@ public function testPrepareLayoutAddsTypeBlock(): void
'request' => $request->reveal(),
'layout' => $layout->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);

Expand Down Expand Up @@ -98,7 +98,7 @@ public function testGetCronExpressionThrowsExceptionIfNoCronCodeSet(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -125,7 +125,7 @@ public function testGetCronExpressionThrowsExceptionIfCronDoesNotExist(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -151,7 +151,7 @@ public function testGetCronExpressionReturnsCronExpression(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => ['my-cron-code' => ['schedule' => '*']]]);
Expand All @@ -176,7 +176,7 @@ public function testHasCronReturnsFalseIfNoCronCodeSet(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -201,7 +201,7 @@ public function testHasCronReturnsFalseIfCronDoesNotExist(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -228,7 +228,7 @@ public function testHasCronReturnsTrueIfCronIsSetAndExists(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => ['my-cron-code' => ['schedule' => '*']]]);
Expand Down Expand Up @@ -256,7 +256,7 @@ public function testGetCronGroupThrowsExceptionIfNoCronCodeSet(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -283,7 +283,7 @@ public function testGetCronGroupThrowsExceptionIfCronDoesNotExist(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -309,7 +309,7 @@ public function testGetCronGroupReturnsCronGroup(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => ['my-cron-code' => ['schedule' => '*']]]);
Expand Down Expand Up @@ -337,7 +337,7 @@ public function testGetCronCodeThrowsExceptionIfNoCronCodeSet(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -364,7 +364,7 @@ public function testGetCronCodeThrowsExceptionIfCronDoesNotExist(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => []]);
Expand All @@ -390,7 +390,7 @@ public function testGetCronCodeReturnsCronCode(): void
$context = $this->getObject(Context::class, [
'request' => $request->reveal()
]);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize);
$config = new Data($reader->reveal(), $cache->reveal(), 'cache-id', new Serialize());

$cron = $this->prophesize(\Magento\Cron\Model\Config::class);
$cron->getJobs()->willReturn(['default' => ['my-cron-code' => ['schedule' => '*']]]);
Expand Down
4 changes: 2 additions & 2 deletions test/Block/TypeFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TypeFilesTest extends TestCase
*/
private $block;

public function setUp() : void
public function setUp(): void
{
$this->tempDirectory = sprintf('%s/%s/var', realpath(sys_get_temp_dir()), $this->getName());
@mkdir($this->tempDirectory, 0777, true);
Expand Down Expand Up @@ -68,7 +68,7 @@ public function setUp() : void
$context,
$this->directoryList,
$this->writeFactory,
new FileMatcher
new FileMatcher()
);
$this->block->setNameInLayout('type-info');
}
Expand Down
22 changes: 11 additions & 11 deletions test/Config/ConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testConvert()
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public function testConvertWithOptionalIndexers()
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -148,7 +148,7 @@ public function testConvertWithNoAdditionalReportHandlers()
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -200,7 +200,7 @@ public function testConvertWithOptionalReportHandlers()
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -242,7 +242,7 @@ public function testConvertNoDirectoriesUsesDefaults()
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -284,7 +284,7 @@ public function testConvertWithNoCron()
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -328,7 +328,7 @@ public function testConvertWithCustomCronGroup()
'cron_group' => 'my-cron-group'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

Expand Down Expand Up @@ -379,11 +379,11 @@ public function testConvertWithTruthyValuesForCleanUp($archiveOldFiles, $deleteO
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

public function fileCleanUpTruthy() : array
public function fileCleanUpTruthy(): array
{
return [
[1, 1],
Expand Down Expand Up @@ -437,11 +437,11 @@ public function testConvertWithFalsyValuesForCleanUp($archiveOldFiles, $deleteOl
'cron_group' => 'default'
]
],
(new Converter)->convert($domDocument)
(new Converter())->convert($domDocument)
);
}

public function fileCleanUpFalsy() : array
public function fileCleanUpFalsy(): array
{
return [
[0, 0],
Expand Down
Loading

0 comments on commit 01bdab4

Please sign in to comment.