Skip to content

Commit

Permalink
[BUGFIX] Make testing setup compatible with latest testing framework …
Browse files Browse the repository at this point in the history
…versions

The signature of the setup method differences between the latest versions
of the testing framework. To ensure compatibility we move the setup overwrites
to a new initialize method for now.
  • Loading branch information
benjaminkott committed May 26, 2019
1 parent 933d046 commit 4abea18
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ composer.lock

# Build stuff
.build/
Build/.phpunit.result.cache
node_modules/
var/
config/
Expand Down
12 changes: 11 additions & 1 deletion Tests/Unit/Service/CommentServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CommentServiceTest extends UnitTestCase
*/
protected $commentService;

public function setUp()
public function initialize()
{
$GLOBALS['TSFE'] = $this->prophesize(TypoScriptFrontendController::class)->reveal();
$this->postRepositoryProphecy = $this->prophesize(PostRepository::class);
Expand All @@ -46,6 +46,8 @@ public function setUp()
*/
public function inactiveCommentsReturnErrorOnAdd(): void
{
$this->initialize();

$post = new Post();
$post->_setProperty('uid', 1);
$comment = new Comment();
Expand All @@ -59,6 +61,8 @@ public function inactiveCommentsReturnErrorOnAdd(): void
*/
public function activeCommentsWithoutModerationReturnSuccessOnAdd(): void
{
$this->initialize();

$post = new Post();
$post->_setProperty('uid', 1);
$comment = new Comment();
Expand All @@ -76,6 +80,8 @@ public function activeCommentsWithoutModerationReturnSuccessOnAdd(): void
*/
public function activeCommentsWithModerationReturnModerationOnAdd(): void
{
$this->initialize();

$post = new Post();
$post->_setProperty('uid', 1);
$comment = new Comment();
Expand All @@ -93,6 +99,8 @@ public function activeCommentsWithModerationReturnModerationOnAdd(): void
*/
public function commentGetsAddedToPost(): void
{
$this->initialize();

$post = new Post();
$post->_setProperty('uid', 1);
$comment = new Comment();
Expand All @@ -110,6 +118,8 @@ public function commentGetsAddedToPost(): void
*/
public function postGetsUpdatedInDatabase(): void
{
$this->initialize();

$post = new Post();
$post->_setProperty('uid', 1);
$comment = new Comment();
Expand Down
7 changes: 3 additions & 4 deletions Tests/Unit/Service/MetaServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ class MetaServiceTest extends UnitTestCase
*/
protected $metaService;

/**
*
*/
public function setUp()
public function initialize()
{
$this->metaService = MetaService::getInstance();
}
Expand Down Expand Up @@ -52,6 +49,8 @@ public function metaDataDataProvider() : array
*/
public function ensureDataCanStoredInMetaService(string $key)
{
$this->initialize();

MetaService::set($key, $key);
self::assertSame($key, MetaService::get($key));
}
Expand Down

0 comments on commit 4abea18

Please sign in to comment.