Skip to content

Commit a45af9a

Browse files
committed
more improvements
1 parent 8017d9c commit a45af9a

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

src/Symfony/Bridge/Doctrine/Tests/Decorator/DoctrineTransactionDecoratorTest.php

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,26 @@ protected function setUp(): void
4343

4444
public function testDecoratorWrapsInTransactionAndFlushes()
4545
{
46-
$this->connection->expects($this->once())
47-
->method('beginTransaction')
48-
;
49-
$this->connection->expects($this->once())
50-
->method('commit')
51-
;
52-
$this->entityManager->expects($this->once())
53-
->method('flush')
54-
;
55-
5646
$handler = new TestHandler();
47+
48+
$this->connection->expects($this->once())->method('beginTransaction');
49+
$this->connection->expects($this->once())->method('commit');
50+
$this->entityManager->expects($this->once())->method('flush');
51+
5752
$result = $this->decorator->call($handler->handle(...));
5853
$this->assertSame('success', $result);
5954
}
6055

6156
public function testTransactionIsRolledBackOnException()
6257
{
63-
$this->connection->expects($this->once())
64-
->method('beginTransaction')
65-
;
66-
$this->connection->expects($this->once())
67-
->method('rollBack')
68-
;
58+
$this->connection->expects($this->once())->method('beginTransaction');
59+
$this->connection->expects($this->once())->method('rollBack');
60+
61+
$handler = new TestHandler();
6962

7063
$this->expectException(\RuntimeException::class);
7164
$this->expectExceptionMessage('A runtime error.');
7265

73-
$handler = new TestHandler();
7466
$this->decorator->call($handler->handleWithError(...));
7567
}
7668

@@ -79,11 +71,12 @@ public function testInvalidEntityManagerThrowsException()
7971
$this->managerRegistry
8072
->method('getManager')
8173
->with('unknown_manager')
82-
->will($this->throwException(new \InvalidArgumentException()));
74+
->willThrowException(new \InvalidArgumentException());
75+
76+
$handler = new TestHandler();
8377

8478
$this->expectException(\InvalidArgumentException::class);
8579

86-
$handler = new TestHandler();
8780
$this->decorator->call($handler->handleWithUnknownManager(...));
8881
}
8982
}

src/Symfony/Component/Decorator/Tests/Fixtures/Decorator/Json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Decorator\Attribute\Decorate;
1515

16-
#[\Attribute(\Attribute::TARGET_FUNCTION | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
16+
#[\Attribute(\Attribute::TARGET_METHOD)]
1717
final class Json extends Decorate
1818
{
1919
public function __construct()

src/Symfony/Component/Decorator/Tests/Fixtures/Decorator/Logging.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Psr\Log\LogLevel;
1515
use Symfony\Component\Decorator\Attribute\Decorate;
1616

17-
#[\Attribute(\Attribute::TARGET_FUNCTION | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
17+
#[\Attribute(\Attribute::TARGET_FUNCTION | \Attribute::TARGET_METHOD)]
1818
final class Logging extends Decorate
1919
{
2020
public function __construct(

src/Symfony/Component/Decorator/Tests/Fixtures/Handler/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
namespace Symfony\Component\Decorator\Tests\Fixtures\Handler;
1313

14-
final readonly class Message
14+
final class Message
1515
{
1616
}

src/Symfony/Component/Decorator/Tests/Fixtures/Handler/MessageHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Psr\Log\LogLevel;
1515
use Symfony\Component\Decorator\Tests\Fixtures\Decorator\Logging;
1616

17-
final readonly class MessageHandler
17+
final class MessageHandler
1818
{
1919
#[Logging]
2020
public function __invoke(Message $message): Message

0 commit comments

Comments
 (0)