Skip to content

Commit

Permalink
Tests: fix TestCase for phpunit 9 (#1221)
Browse files Browse the repository at this point in the history
* Fix forward all unit test compatibiliy with phpunit 9 by
  updating setUp and tearDown function signatures.
  • Loading branch information
yookoala authored Jan 27, 2021
1 parent 3e27884 commit 9027147
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/unit/Data/UsernameGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UsernameGeneratorTest extends TestCase
{
private $usernameGenerator;

public function setUp()
public function setUp(): void
{
// Create a stub for the Gibbon\Contracts\Database\Connection class
$mockPDO = $this->createMock(Connection::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Domain/QueryCriteriaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class QueryCriteriaTest extends TestCase
*/
private $criteria;

public function setUp()
public function setUp(): void
{
$this->criteria = new QueryCriteria();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Domain/QueryableGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class QueryableGatewayTest extends TestCase
{
private $gateway;

public function setUp()
public function setUp(): void
{
$this->gateway = $this
->getMockBuilder(QueryableGateway::class)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Domain/System/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ModuleTest extends TestCase
{
protected $module;

public function setUp()
public function setUp(): void
{
$this->module = $this->getMockBuilder(Module::class)
->setConstructorArgs([])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Domain/System/ThemeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ThemeTest extends TestCase
{
protected $theme;

public function setUp()
public function setUp(): void
{
$this->theme = $this->getMockBuilder(Theme::class)
->setConstructorArgs([])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Forms/Layout/RowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RowTest extends TestCase
private $mockFactory;
private $mockElement;

public function setUp()
public function setUp(): void
{
$this->mockFactory = $this->createMock('Gibbon\Forms\FormFactoryInterface');
$this->mockElement = $this->createMock('Gibbon\Forms\OutputableInterface');
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Gibbon/FileUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FileUploaderTest extends TestCase

private $fileUploader;

public function setUp()
public function setUp(): void
{
// Mock the database results for a gibbonFileExtensions query
$mockResults = $this->createMock(\PDOStatement::class);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Gibbon/Locale/TranslateNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TranslateNTest extends TestCase
private $locale;
private $gibbonToRestore;

public function setUp()
public function setUp(): void
{

// Setup the composer autoloader
Expand Down Expand Up @@ -57,7 +57,7 @@ public function setUp()
];
}

public function tearDown()
public function tearDown(): void
{
global $gibbon;
unset($gibbon);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Gibbon/Locale/TranslateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TranslateTest extends TestCase
private $locale;
private $gibbonToRestore;

public function setUp()
public function setUp(): void
{

// Setup the composer autoloader
Expand Down Expand Up @@ -57,7 +57,7 @@ public function setUp()
];
}

public function tearDown()
public function tearDown(): void
{
global $gibbon;
unset($gibbon);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Gibbon/TranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TranslationTest extends TestCase
{
protected $guid;

public function setUp()
public function setUp(): void
{
global $guid, $gibbon;

Expand All @@ -28,7 +28,7 @@ public function setUp()
$this->guid = $guid;
}

public function tearDown()
public function tearDown(): void
{
global $gibbon;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Installer/ProcessConfigVarsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ProcessConfigVarsTest extends TestCase {
/**
* @inherit
*/
public function setUp() {
public function setUp(): void {
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../../../resources/templates');
$this->templateEngine = new \Twig\Environment($loader);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Services/FormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class FormatTest extends TestCase
{
public function setUp()
public function setUp(): void
{
$settings = [
'code' => 'en_GB',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/View/PageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PageTest extends TestCase
protected $mockModule;
protected $mockTheme;

public function setUp()
public function setUp(): void
{
$this->prebuiltPage = new Page(null, [
'module' => new Module(),
Expand Down

0 comments on commit 9027147

Please sign in to comment.