change tests for phpunit 9 support, breaking support with phpunit 5.6
This commit is contained in:
@@ -122,124 +122,102 @@ class DatabaseTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PDOException
|
||||
*/
|
||||
public function testGetIbmInstance()
|
||||
{
|
||||
$this->expectException(PDOException::class);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PDOException
|
||||
*/
|
||||
public function testGetInformixInstance()
|
||||
{
|
||||
$this->expectException(PDOException::class);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PDOException
|
||||
*/
|
||||
public function testGetMssqlInstance()
|
||||
{
|
||||
$this->expectException(PDOException::class);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PDOException
|
||||
*/
|
||||
public function testGetMysqlInstance()
|
||||
{
|
||||
$this->expectException(PDOException::class);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PDOException
|
||||
*/
|
||||
public function testGetOciInstance()
|
||||
{
|
||||
$this->expectException(PDOException::class);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PDOException
|
||||
*/
|
||||
public function testGetPgsqlInstance()
|
||||
{
|
||||
$this->expectException(PDOException::class);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 5
|
||||
*/
|
||||
public function testGetFooInstance()
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionCode(5);
|
||||
Database::getInstance(array(
|
||||
'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 6
|
||||
*/
|
||||
public function testMissingDsn()
|
||||
{
|
||||
$options = $this->_options;
|
||||
unset($options['dsn']);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionCode(6);
|
||||
Database::getInstance($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 6
|
||||
*/
|
||||
public function testMissingUsr()
|
||||
{
|
||||
$options = $this->_options;
|
||||
unset($options['usr']);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionCode(6);
|
||||
Database::getInstance($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 6
|
||||
*/
|
||||
public function testMissingPwd()
|
||||
{
|
||||
$options = $this->_options;
|
||||
unset($options['pwd']);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionCode(6);
|
||||
Database::getInstance($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionCode 6
|
||||
*/
|
||||
public function testMissingOpt()
|
||||
{
|
||||
$options = $this->_options;
|
||||
unset($options['opt']);
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionCode(6);
|
||||
Database::getInstance($options);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,13 +162,13 @@ class FilesystemTest extends TestCase
|
||||
$this->_model->purge(10);
|
||||
foreach ($ids as $dataid => $storagedir) {
|
||||
$this->assertFileExists($storagedir . $dataid . '.php', "paste $dataid exists in new format");
|
||||
$this->assertFileNotExists($storagedir . $dataid, "old format paste $dataid got removed");
|
||||
$this->assertFileDoesNotExist($storagedir . $dataid, "old format paste $dataid got removed");
|
||||
$this->assertTrue($this->_model->exists($dataid), "paste $dataid exists");
|
||||
$this->assertEquals($this->_model->read($dataid), $paste, "paste $dataid wasn't modified in the conversion");
|
||||
|
||||
$storagedir .= $dataid . '.discussion' . DIRECTORY_SEPARATOR;
|
||||
$this->assertFileExists($storagedir . $dataid . '.' . $commentid . '.' . $dataid . '.php', "comment of $dataid exists in new format");
|
||||
$this->assertFileNotExists($storagedir . $dataid . '.' . $commentid . '.' . $dataid, "old format comment of $dataid got removed");
|
||||
$this->assertFileDoesNotExist($storagedir . $dataid . '.' . $commentid . '.' . $dataid, "old format comment of $dataid got removed");
|
||||
$this->assertTrue($this->_model->existsComment($dataid, $dataid, $commentid), "comment in paste $dataid exists");
|
||||
$comment = $comment;
|
||||
$comment['id'] = $commentid;
|
||||
|
||||
Reference in New Issue
Block a user