Commit d00891a 1 parent a9ff7d7 commit d00891a Copy full SHA for d00891a
File tree 6 files changed +28
-12
lines changed
src/DAMA/DoctrineTestBundle/Doctrine/DBAL
DAMA/DoctrineTestBundle/Doctrine/DBAL
6 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ public function commit(): bool
54
54
throw new \BadMethodCallException (sprintf ('Bad call to "%s". There is no savepoint for a nested transaction. ' , __METHOD__ ));
55
55
}
56
56
57
- $ this ->exec ($ this ->platform ->releaseSavePoint (self ::SAVEPOINT_NAME ));
57
+ if ($ this ->platform ->supportsReleaseSavepoints ()) {
58
+ $ this ->exec ($ this ->platform ->releaseSavePoint (self ::SAVEPOINT_NAME ));
59
+ }
58
60
59
61
$ this ->nested = false ;
60
62
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public function connect(array $params): DriverConnection
51
51
? $ this ->createDatabasePlatformForVersion ($ params ['serverVersion ' ])
52
52
: $ this ->getDatabasePlatform ());
53
53
54
- if (!$ platform ->supportsSavepoints () || ! $ platform -> supportsReleaseSavepoints () ) {
54
+ if (!$ platform ->supportsSavepoints ()) {
55
55
throw new \RuntimeException ('This bundle only works for database platforms that support savepoints. ' );
56
56
}
57
57
Original file line number Diff line number Diff line change 8
8
use Doctrine \DBAL \Platforms \AbstractPlatform ;
9
9
use Doctrine \DBAL \Platforms \MySQL80Platform ;
10
10
use Doctrine \DBAL \Schema \AbstractSchemaManager ;
11
- use PHPUnit \Framework \MockObject \Generator ;
12
11
13
12
class MockDriver implements Driver
14
13
{
15
14
private function getMock (string $ class )
16
15
{
17
- return (new Generator ())->getMock (
16
+ // TODO: remove this once we drop support for PHPUnit < 10
17
+ $ generatorClass = class_exists ('PHPUnit\Framework\MockObject\Generator ' )
18
+ ? 'PHPUnit\Framework\MockObject\Generator '
19
+ : 'PHPUnit\Framework\MockObject\Generator\Generator ' ;
20
+
21
+ /** @phpstan-ignore-next-line */
22
+ return (new $ generatorClass ())->getMock (
18
23
$ class ,
19
24
[],
20
25
[],
Original file line number Diff line number Diff line change @@ -69,11 +69,6 @@ public function testConnectWithPlatform(): void
69
69
->method ('supportsSavepoints ' )
70
70
->willReturn (true )
71
71
;
72
- $ platform
73
- ->expects (self ::exactly (7 ))
74
- ->method ('supportsReleaseSavepoints ' )
75
- ->willReturn (true )
76
- ;
77
72
78
73
$ params = [
79
74
'driver ' => 'pdo_mysql ' ,
Original file line number Diff line number Diff line change @@ -79,10 +79,21 @@ public function testChangeDbStateWithinTransaction(): void
79
79
$ this ->rollbackTransaction ();
80
80
$ this ->assertRowCount (0 );
81
81
82
+ $ this ->beginTransaction ();
83
+ $ this ->insertRow ();
84
+ $ this ->assertRowCount (1 );
85
+ $ this ->rollbackTransaction ();
86
+ $ this ->assertRowCount (0 );
87
+
82
88
$ this ->beginTransaction ();
83
89
$ this ->insertRow ();
84
90
$ this ->commitTransaction ();
85
91
$ this ->assertRowCount (1 );
92
+
93
+ $ this ->beginTransaction ();
94
+ $ this ->insertRow ();
95
+ $ this ->commitTransaction ();
96
+ $ this ->assertRowCount (2 );
86
97
}
87
98
88
99
/**
Original file line number Diff line number Diff line change 2
2
3
3
namespace Tests \Functional \app ;
4
4
5
+ use DAMA \DoctrineTestBundle \DAMADoctrineTestBundle ;
6
+ use Doctrine \Bundle \DoctrineBundle \DoctrineBundle ;
5
7
use Psr \Log \NullLogger ;
8
+ use Symfony \Bundle \FrameworkBundle \FrameworkBundle ;
6
9
use Symfony \Component \Config \Loader \LoaderInterface ;
7
10
use Symfony \Component \DependencyInjection \ContainerBuilder ;
8
11
use Symfony \Component \HttpKernel \Kernel ;
@@ -12,9 +15,9 @@ class AppKernel extends Kernel
12
15
public function registerBundles (): array
13
16
{
14
17
return [
15
- new \ Symfony \ Bundle \ FrameworkBundle \ FrameworkBundle (),
16
- new \ Doctrine \ Bundle \ DoctrineBundle \ DoctrineBundle (),
17
- new \ DAMA \ DoctrineTestBundle \ DAMADoctrineTestBundle (),
18
+ new FrameworkBundle (),
19
+ new DoctrineBundle (),
20
+ new DAMADoctrineTestBundle (),
18
21
];
19
22
}
20
23
You can’t perform that action at this time.
0 commit comments