Skip to content

Commit fd8c75b

Browse files
author
Bizley
committed
MSI
1 parent 877406d commit fd8c75b

Some content is hidden

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

43 files changed

+740
-5
lines changed

src/Services/Member/MemberRemover.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function remove(RepositoryInterface $member): PodiumResponse
5454
return PodiumResponse::error($exc->getErrorList());
5555
} catch (Throwable $exc) {
5656
$transaction->rollBack();
57-
Yii::error(['Exception while removing member', $exc->getMessage(), $exc->getTraceAsString()], 'podium');
57+
Yii::error(['Exception while deleting member', $exc->getMessage(), $exc->getTraceAsString()], 'podium');
5858

5959
return PodiumResponse::error(['exception' => $exc]);
6060
}

src/Services/Message/MessageRemover.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function remove(MessageRepositoryInterface $message, MemberRepositoryInte
6464
return PodiumResponse::error($exc->getErrorList());
6565
} catch (Throwable $exc) {
6666
$transaction->rollBack();
67-
Yii::error(['Exception while removing message', $exc->getMessage(), $exc->getTraceAsString()], 'podium');
67+
Yii::error(['Exception while deleting message', $exc->getMessage(), $exc->getTraceAsString()], 'podium');
6868

6969
return PodiumResponse::error(['exception' => $exc]);
7070
}

src/Services/Rank/RankRemover.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function remove(RepositoryInterface $rank): PodiumResponse
5454
return PodiumResponse::error($exc->getErrorList());
5555
} catch (Throwable $exc) {
5656
$transaction->rollBack();
57-
Yii::error(['Exception while removing rank', $exc->getMessage(), $exc->getTraceAsString()], 'podium');
57+
Yii::error(['Exception while deleting rank', $exc->getMessage(), $exc->getTraceAsString()], 'podium');
5858

5959
return PodiumResponse::error(['exception' => $exc]);
6060
}

tests/Unit/Category/CategoryArchiverTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ static function (array $data) {
7878
&& 'Exception while archiving category' === $data[0]
7979
&& 'exc' === $data[1];
8080
}
81-
)
81+
),
82+
1,
83+
'podium'
8284
);
8385

8486
$category = $this->createMock(CategoryRepositoryInterface::class);
@@ -144,7 +146,9 @@ public function testReviveShouldReturnErrorWhenRevivingThrowsException(): void
144146
static function (array $data) {
145147
return 3 === count($data) && 'Exception while reviving category' === $data[0] && 'exc' === $data[1];
146148
}
147-
)
149+
),
150+
1,
151+
'podium'
148152
);
149153

150154
$category = $this->createMock(CategoryRepositoryInterface::class);

tests/Unit/Category/CategoryBuilderTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ public function testCreateShouldReturnSuccessWhenCreatingIsDone(): void
4747
public function testCreateShouldReturnErrorWhenCreatingThrowsException(): void
4848
{
4949
$this->transaction->expects(self::once())->method('rollBack');
50+
$this->logger->expects(self::once())->method('log')->with(
51+
self::callback(
52+
static function (array $data) {
53+
return 3 === count($data) && 'Exception while creating category' === $data[0] && 'exc' === $data[1];
54+
}
55+
),
56+
1,
57+
'podium'
58+
);
5059

5160
$category = $this->createMock(CategoryRepositoryInterface::class);
5261
$category->method('create')->willThrowException(new Exception('exc'));
@@ -83,6 +92,15 @@ public function testEditShouldReturnSuccessWhenEditingIsDone(): void
8392
public function testEditShouldReturnErrorWhenEditingThrowsException(): void
8493
{
8594
$this->transaction->expects(self::once())->method('rollBack');
95+
$this->logger->expects(self::once())->method('log')->with(
96+
self::callback(
97+
static function (array $data) {
98+
return 3 === count($data) && 'Exception while editing category' === $data[0] && 'exc' === $data[1];
99+
}
100+
),
101+
1,
102+
'podium'
103+
);
86104

87105
$category = $this->createMock(CategoryRepositoryInterface::class);
88106
$category->method('edit')->willThrowException(new Exception('exc'));

tests/Unit/Category/CategoryRemoverTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ public function testRemoveShouldReturnErrorWhenRemovingThrowsException(): void
8282
public function testRemoveShouldReturnErrorWhenIsArchivedThrowsException(): void
8383
{
8484
$this->transaction->expects(self::once())->method('rollBack');
85+
$this->logger->expects(self::once())->method('log')->with(
86+
self::callback(
87+
static function (array $data) {
88+
return 3 === count($data) && 'Exception while deleting category' === $data[0] && 'exc' === $data[1];
89+
}
90+
),
91+
1,
92+
'podium'
93+
);
8594

8695
$category = $this->createMock(CategoryRepositoryInterface::class);
8796
$category->method('isArchived')->willThrowException(new Exception('exc'));

tests/Unit/Category/CategorySorterTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ public function testReplaceShouldReturnSuccessWhenReplacingIsDone(): void
8484
public function testReplaceShouldReturnErrorWhenReplacingThrowsException(): void
8585
{
8686
$this->transaction->expects(self::once())->method('rollBack');
87+
$this->logger->expects(self::once())->method('log')->with(
88+
self::callback(
89+
static function (array $data) {
90+
return 3 === count($data)
91+
&& 'Exception while replacing categories order' === $data[0]
92+
&& 'exc' === $data[1];
93+
}
94+
),
95+
1,
96+
'podium'
97+
);
8798

8899
$category = $this->createMock(CategoryRepositoryInterface::class);
89100
$category->method('getOrder')->willReturn(1);
@@ -119,6 +130,17 @@ public function testSortShouldReturnSuccessWhenSortingIsDone(): void
119130
public function testSortShouldReturnErrorWhenSortingThrowsException(): void
120131
{
121132
$this->transaction->expects(self::once())->method('rollBack');
133+
$this->logger->expects(self::once())->method('log')->with(
134+
self::callback(
135+
static function (array $data) {
136+
return 3 === count($data)
137+
&& 'Exception while sorting categories' === $data[0]
138+
&& 'exc' === $data[1];
139+
}
140+
),
141+
1,
142+
'podium'
143+
);
122144

123145
$category = $this->createMock(CategoryRepositoryInterface::class);
124146
$category->method('sort')->willThrowException(new Exception('exc'));

tests/Unit/Forum/ForumArchiverTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ public function testArchiveShouldReturnSuccessWhenArchivingIsDone(): void
6868
public function testArchiveShouldReturnErrorWhenArchivingThrowsException(): void
6969
{
7070
$this->transaction->expects(self::once())->method('rollBack');
71+
$this->logger->expects(self::once())->method('log')->with(
72+
self::callback(
73+
static function (array $data) {
74+
return 3 === count($data) && 'Exception while archiving forum' === $data[0] && 'exc' === $data[1];
75+
}
76+
),
77+
1,
78+
'podium'
79+
);
7180

7281
$forum = $this->createMock(ForumRepositoryInterface::class);
7382
$forum->method('isArchived')->willReturn(false);
@@ -127,6 +136,15 @@ public function testReviveShouldReturnSuccessWhenRevivingIsDone(): void
127136
public function testReviveShouldReturnErrorWhenRevivingThrowsException(): void
128137
{
129138
$this->transaction->expects(self::once())->method('rollBack');
139+
$this->logger->expects(self::once())->method('log')->with(
140+
self::callback(
141+
static function (array $data) {
142+
return 3 === count($data) && 'Exception while reviving forum' === $data[0] && 'exc' === $data[1];
143+
}
144+
),
145+
1,
146+
'podium'
147+
);
130148

131149
$forum = $this->createMock(ForumRepositoryInterface::class);
132150
$forum->method('isArchived')->willReturn(true);

tests/Unit/Forum/ForumBuilderTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ public function testCreateShouldReturnSuccessWhenCreatingIsDone(): void
6868
public function testCreateShouldReturnErrorWhenCreatingThrowsException(): void
6969
{
7070
$this->transaction->expects(self::once())->method('rollBack');
71+
$this->logger->expects(self::once())->method('log')->with(
72+
self::callback(
73+
static function (array $data) {
74+
return 3 === count($data) && 'Exception while creating forum' === $data[0] && 'exc' === $data[1];
75+
}
76+
),
77+
1,
78+
'podium'
79+
);
7180

7281
$forum = $this->createMock(ForumRepositoryInterface::class);
7382
$forum->method('create')->willThrowException(new Exception('exc'));
@@ -115,6 +124,15 @@ public function testEditShouldReturnSuccessWhenEditingIsDone(): void
115124
public function testEditShouldReturnErrorWhenEditingThrowsException(): void
116125
{
117126
$this->transaction->expects(self::once())->method('rollBack');
127+
$this->logger->expects(self::once())->method('log')->with(
128+
self::callback(
129+
static function (array $data) {
130+
return 3 === count($data) && 'Exception while editing forum' === $data[0] && 'exc' === $data[1];
131+
}
132+
),
133+
1,
134+
'podium'
135+
);
118136

119137
$forum = $this->createMock(ForumRepositoryInterface::class);
120138
$forum->method('edit')->willThrowException(new Exception('exc'));

tests/Unit/Forum/ForumMoverTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ public function testMoveShouldReturnSuccessWhenMovingIsDone(): void
6969
public function testMoveShouldReturnErrorWhenMovingThrowsException(): void
7070
{
7171
$this->transaction->expects(self::once())->method('rollBack');
72+
$this->logger->expects(self::once())->method('log')->with(
73+
self::callback(
74+
static function (array $data) {
75+
return 3 === count($data) && 'Exception while moving forum' === $data[0] && 'exc' === $data[1];
76+
}
77+
),
78+
1,
79+
'podium'
80+
);
7281

7382
$forum = $this->createMock(ForumRepositoryInterface::class);
7483
$forum->method('move')->willThrowException(new Exception('exc'));

0 commit comments

Comments
 (0)