Skip to content

Commit

Permalink
Tests - Fix test; getDatabase() is no longer public
Browse files Browse the repository at this point in the history
  • Loading branch information
nibra committed Mar 2, 2022
1 parent bf0c004 commit 1944153
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Tests/DatabaseAwareTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ public function testGetSetDatabase(): void
{
$db = $this->createMock(DatabaseInterface::class);

$trait = $this->getObjectForTrait(DatabaseAwareTrait::class);
$trait = new class {
use DatabaseAwareTrait;

public function getDb()
{
return $this->getDatabase();
}
};

$trait->setDatabase($db);

$this->assertSame($db, $trait->getDatabase());
$this->assertSame($db, $trait->getDb());
}

/**
Expand All @@ -46,8 +54,15 @@ public function testGetDatabaseException(): void
{
$this->expectException(DatabaseNotFoundException::class);

$trait = $this->getObjectForTrait(DatabaseAwareTrait::class);
$trait = new class {
use DatabaseAwareTrait;

public function getDb()
{
return $this->getDatabase();
}
};

$trait->getDatabase();
$trait->getDb();
}
}

0 comments on commit 1944153

Please sign in to comment.