diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 17:27:18 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 17:27:18 +0300 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /tests/lib/DB/ConnectionTest.php | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/DB/ConnectionTest.php')
-rw-r--r-- | tests/lib/DB/ConnectionTest.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php index 4683c53d339..607674d7a38 100644 --- a/tests/lib/DB/ConnectionTest.php +++ b/tests/lib/DB/ConnectionTest.php @@ -42,12 +42,12 @@ class ConnectionTest extends \Test\TestCase { } } - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->connection = \OC::$server->getDatabaseConnection(); } - public function tearDown(): void { + protected function tearDown(): void { parent::tearDown(); $this->connection->dropTable('table'); } @@ -157,10 +157,10 @@ class ConnectionTest extends \Test\TestCase { $this->assertEquals('bar', $this->getTextValueByIntergerField(1)); } - /** - * @expectedException \OCP\PreConditionNotMetException - */ + public function testSetValuesOverWritePreconditionFailed() { + $this->expectException(\OCP\PreConditionNotMetException::class); + $this->makeTestTable(); $this->connection->setValues('table', [ 'integerfield' => 1 @@ -335,10 +335,10 @@ class ConnectionTest extends \Test\TestCase { $this->assertEquals(0, $result); } - /** - * @expectedException \Doctrine\DBAL\Exception\UniqueConstraintViolationException - */ + public function testUniqueConstraintViolating() { + $this->expectException(\Doctrine\DBAL\Exception\UniqueConstraintViolationException::class); + $this->makeTestTable(); $testQuery = 'INSERT INTO `*PREFIX*table` (`integerfield`, `textfield`) VALUES(?, ?)'; |