Skip to content

Commit bdd6229

Browse files
authored
Clean up units + add license docblocks (#29)
2 parents 4ea1073 + 43e795e commit bdd6229

File tree

53 files changed

+986
-1963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+986
-1963
lines changed

ecs.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22

33
declare(strict_types=1);
44

5+
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
56
use Symplify\EasyCodingStandard\Config\ECSConfig;
67

78
return static function (ECSConfig $config): void {
89
$config->import('vendor/sylius-labs/coding-standard/ecs.php');
910
$config->paths(['src', 'tests/Integration', 'tests/Behat', 'tests/Functional', 'tests/Unit']);
11+
12+
$config->ruleWithConfiguration(
13+
HeaderCommentFixer::class,
14+
[
15+
'location' => 'after_open',
16+
'comment_type' => HeaderCommentFixer::HEADER_COMMENT,
17+
'header' => <<<TEXT
18+
This file is part of the Sylius package.
19+
20+
(c) Sylius Sp. z o.o.
21+
22+
For the full copyright and license information, please view the LICENSE
23+
file that was distributed with this source code.
24+
TEXT
25+
]
26+
);
1027
};

src/Migrations/Version20201029161558.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
811

912
declare(strict_types=1);
1013

src/Migrations/Version20210428130552.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
811

912
declare(strict_types=1);
1013

src/Migrations/Version20230522123447.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
811

912
declare(strict_types=1);
1013

src/Migrations/Version20231015123538.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
811

912
declare(strict_types=1);
1013

src/Migrations/Version20231030194730.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
811

912
declare(strict_types=1);
1013

src/Migrations/Version20250427090022.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
declare(strict_types=1);
413

514
namespace Sylius\WishlistPlugin\Migrations;

src/Migrations/Version20250429195905.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
declare(strict_types=1);
413

514
namespace Sylius\WishlistPlugin\Migrations;

tests/Unit/CommandHandler/Wishlist/AddProductToSelectedWishlistHandlerTest.php

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
declare(strict_types=1);
413

514
namespace Tests\Sylius\WishlistPlugin\Unit\CommandHandler\Wishlist;
@@ -44,28 +53,12 @@ public function testShouldAddProductToWishlistIfProductIsFound(): void
4453
$wishlist = $this->createMock(WishlistInterface::class);
4554
$wishlistProduct = $this->createMock(WishlistProductInterface::class);
4655

47-
$command
48-
->expects($this->once())
49-
->method('getProduct')
50-
->willReturn($product);
51-
$command
52-
->expects($this->once())
53-
->method('getWishlist')
54-
->willReturn($wishlist);
55-
$this->wishlistProductFactory
56-
->expects($this->once())
57-
->method('createForWishlistAndProduct')
58-
->with($wishlist, $product)
59-
->willReturn($wishlistProduct);
60-
$wishlist
61-
->expects($this->once())
62-
->method('addWishlistProduct')
63-
->with($wishlistProduct);
64-
$this->wishlistRepository
65-
->expects($this->once())
66-
->method('add')
67-
->with($wishlist);
56+
$command->expects($this->once())->method('getProduct')->willReturn($product);
57+
$command->expects($this->once())->method('getWishlist')->willReturn($wishlist);
58+
$this->wishlistProductFactory->expects($this->once())->method('createForWishlistAndProduct')->with($wishlist, $product)->willReturn($wishlistProduct);
59+
$wishlist->expects($this->once())->method('addWishlistProduct')->with($wishlistProduct);
60+
$this->wishlistRepository->expects($this->once())->method('add')->with($wishlist);
6861

69-
$this->handler->__invoke($command);
62+
($this->handler)($command);
7063
}
7164
}

tests/Unit/CommandHandler/Wishlist/AddProductToWishlistHandlerTest.php

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Sylius Sp. z o.o.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
declare(strict_types=1);
413

514
namespace Tests\Sylius\WishlistPlugin\Unit\CommandHandler\Wishlist;
@@ -58,56 +67,24 @@ public function testShouldBeInitializable(): void
5867

5968
public function testShouldAddProductToWishlist(): void
6069
{
61-
$this->productRepository
62-
->expects($this->once())
63-
->method('find')
64-
->with(1)
65-
->willReturn($this->product);
66-
$this->wishlistProductFactory
67-
->expects($this->once())
68-
->method('createForWishlistAndProduct')
69-
->with($this->wishlist, $this->product)
70-
->willReturn($this->wishlistProduct);
71-
$this->wishlist
72-
->expects($this->once())
73-
->method('addWishlistProduct')
74-
->with($this->wishlistProduct);
75-
$this->wishlistManager
76-
->expects($this->once())
77-
->method('persist')
78-
->with($this->wishlistProduct);
79-
$this->wishlistManager
80-
->expects($this->once())
81-
->method('flush');
82-
83-
$this->handler->__invoke($this->command);
70+
$this->productRepository->expects($this->once())->method('find')->with(1)->willReturn($this->product);
71+
$this->wishlistProductFactory->expects($this->once())->method('createForWishlistAndProduct')->with($this->wishlist, $this->product)->willReturn($this->wishlistProduct);
72+
$this->wishlist->expects($this->once())->method('addWishlistProduct')->with($this->wishlistProduct);
73+
$this->wishlistManager->expects($this->once())->method('persist')->with($this->wishlistProduct);
74+
$this->wishlistManager->expects($this->once())->method('flush');
75+
76+
($this->handler)($this->command);
8477
}
8578

8679
public function testShouldThrowExceptionIfProductIsNotFound(): void
8780
{
8881
$this->expectException(ProductNotFoundException::class);
89-
$this->productRepository
90-
->expects($this->once())
91-
->method('find')
92-
->with(1)
93-
->willReturn(null);
94-
$this->wishlistProductFactory
95-
->expects($this->never())
96-
->method('createForWishlistAndProduct')
97-
->with($this->wishlist, $this->product)
98-
->willReturn($this->wishlistProduct);
99-
$this->wishlist
100-
->expects($this->never())
101-
->method('addWishlistProduct')
102-
->with($this->wishlistProduct);
103-
$this->wishlistManager
104-
->expects($this->never())
105-
->method('persist')
106-
->with($this->wishlistProduct);
107-
$this->wishlistManager
108-
->expects($this->never())
109-
->method('flush');
110-
111-
$this->handler->__invoke($this->command);
82+
$this->productRepository->expects($this->once())->method('find')->with(1)->willReturn(null);
83+
$this->wishlistProductFactory->expects($this->never())->method('createForWishlistAndProduct')->with($this->wishlist, $this->product)->willReturn($this->wishlistProduct);
84+
$this->wishlist->expects($this->never())->method('addWishlistProduct')->with($this->wishlistProduct);
85+
$this->wishlistManager->expects($this->never())->method('persist')->with($this->wishlistProduct);
86+
$this->wishlistManager->expects($this->never())->method('flush');
87+
88+
($this->handler)($this->command);
11289
}
11390
}

0 commit comments

Comments
 (0)