Skip to content

Commit 3ea9ee6

Browse files
committed
[2323] add adapter connect
1 parent 1259617 commit 3ea9ee6

1 file changed

Lines changed: 36 additions & 12 deletions

File tree

tests/Phinx/Db/Adapter/MysqlAdapterTest.php

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,8 +2798,10 @@ public function testPdoNotPersistentConnection()
27982798
$this->assertFalse($adapter->getConnection()->getAttribute(PDO::ATTR_PERSISTENT));
27992799
}
28002800

2801-
public function testAddColumnWithAlgorithmInstant()
2801+
public function testAddColumnWithAlgorithmInstant(): void
28022802
{
2803+
$this->adapter->connect();
2804+
28032805
$table = new Table('users', [], $this->adapter);
28042806
$table->addColumn('email', 'string')
28052807
->create();
@@ -2812,8 +2814,10 @@ public function testAddColumnWithAlgorithmInstant()
28122814
$this->assertTrue($this->adapter->hasColumn('users', 'status'));
28132815
}
28142816

2815-
public function testAddColumnWithAlgorithmAndLock()
2817+
public function testAddColumnWithAlgorithmAndLock(): void
28162818
{
2819+
$this->adapter->connect();
2820+
28172821
$table = new Table('products', [], $this->adapter);
28182822
$table->addColumn('name', 'string')
28192823
->create();
@@ -2830,8 +2834,10 @@ public function testAddColumnWithAlgorithmAndLock()
28302834
$this->assertTrue($this->adapter->hasColumn('products', 'price'));
28312835
}
28322836

2833-
public function testChangeColumnWithAlgorithm()
2837+
public function testChangeColumnWithAlgorithm(): void
28342838
{
2839+
$this->adapter->connect();
2840+
28352841
$table = new Table('items', [], $this->adapter);
28362842
$table->addColumn('description', 'string', ['limit' => 100])
28372843
->create();
@@ -2850,8 +2856,10 @@ public function testChangeColumnWithAlgorithm()
28502856
}
28512857
}
28522858

2853-
public function testBatchedOperationsWithSameAlgorithm()
2859+
public function testBatchedOperationsWithSameAlgorithm(): void
28542860
{
2861+
$this->adapter->connect();
2862+
28552863
$table = new Table('batch_test', [], $this->adapter);
28562864
$table->addColumn('col1', 'string')
28572865
->create();
@@ -2870,8 +2878,10 @@ public function testBatchedOperationsWithSameAlgorithm()
28702878
$this->assertTrue($this->adapter->hasColumn('batch_test', 'col3'));
28712879
}
28722880

2873-
public function testBatchedOperationsWithConflictingAlgorithmsThrowsException()
2881+
public function testBatchedOperationsWithConflictingAlgorithmsThrowsException(): void
28742882
{
2883+
$this->adapter->connect();
2884+
28752885
$table = new Table('conflict_test', [], $this->adapter);
28762886
$table->addColumn('col1', 'string')
28772887
->create();
@@ -2890,8 +2900,10 @@ public function testBatchedOperationsWithConflictingAlgorithmsThrowsException()
28902900
->update();
28912901
}
28922902

2893-
public function testBatchedOperationsWithConflictingLocksThrowsException()
2903+
public function testBatchedOperationsWithConflictingLocksThrowsException(): void
28942904
{
2905+
$this->adapter->connect();
2906+
28952907
$table = new Table('lock_conflict_test', [], $this->adapter);
28962908
$table->addColumn('col1', 'string')
28972909
->create();
@@ -2912,8 +2924,10 @@ public function testBatchedOperationsWithConflictingLocksThrowsException()
29122924
->update();
29132925
}
29142926

2915-
public function testInvalidAlgorithmThrowsException()
2927+
public function testInvalidAlgorithmThrowsException(): void
29162928
{
2929+
$this->adapter->connect();
2930+
29172931
$table = new Table('invalid_algo', [], $this->adapter);
29182932
$table->addColumn('col1', 'string')
29192933
->create();
@@ -2926,8 +2940,10 @@ public function testInvalidAlgorithmThrowsException()
29262940
])->update();
29272941
}
29282942

2929-
public function testInvalidLockThrowsException()
2943+
public function testInvalidLockThrowsException(): void
29302944
{
2945+
$this->adapter->connect();
2946+
29312947
$table = new Table('invalid_lock', [], $this->adapter);
29322948
$table->addColumn('col1', 'string')
29332949
->create();
@@ -2940,8 +2956,10 @@ public function testInvalidLockThrowsException()
29402956
])->update();
29412957
}
29422958

2943-
public function testAlgorithmInstantWithExplicitLockThrowsException()
2959+
public function testAlgorithmInstantWithExplicitLockThrowsException(): void
29442960
{
2961+
$this->adapter->connect();
2962+
29452963
$table = new Table('instant_lock_test', [], $this->adapter);
29462964
$table->addColumn('col1', 'string')
29472965
->create();
@@ -2956,24 +2974,30 @@ public function testAlgorithmInstantWithExplicitLockThrowsException()
29562974
])->update();
29572975
}
29582976

2959-
public function testAlgorithmConstantsAreDefined()
2977+
public function testAlgorithmConstantsAreDefined(): void
29602978
{
2979+
$this->adapter->connect();
2980+
29612981
$this->assertEquals('DEFAULT', MysqlAdapter::ALGORITHM_DEFAULT);
29622982
$this->assertEquals('INSTANT', MysqlAdapter::ALGORITHM_INSTANT);
29632983
$this->assertEquals('INPLACE', MysqlAdapter::ALGORITHM_INPLACE);
29642984
$this->assertEquals('COPY', MysqlAdapter::ALGORITHM_COPY);
29652985
}
29662986

2967-
public function testLockConstantsAreDefined()
2987+
public function testLockConstantsAreDefined(): void
29682988
{
2989+
$this->adapter->connect();
2990+
29692991
$this->assertEquals('DEFAULT', MysqlAdapter::LOCK_DEFAULT);
29702992
$this->assertEquals('NONE', MysqlAdapter::LOCK_NONE);
29712993
$this->assertEquals('SHARED', MysqlAdapter::LOCK_SHARED);
29722994
$this->assertEquals('EXCLUSIVE', MysqlAdapter::LOCK_EXCLUSIVE);
29732995
}
29742996

2975-
public function testAlgorithmWithMixedCase()
2997+
public function testAlgorithmWithMixedCase(): void
29762998
{
2999+
$this->adapter->connect();
3000+
29773001
$table = new Table('mixed_case', [], $this->adapter);
29783002
$table->addColumn('col1', 'string')
29793003
->create();

0 commit comments

Comments
 (0)