Created
August 6, 2020 08:48
-
-
Save jaggy/0bb7b68d1868948c05e433549eaa5d4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\SetupTraits; | |
trait SetupTraits | |
{ | |
protected function setUpTraits() | |
{ | |
$this->setupAdditionalTraits( | |
parent::setUpTraits() | |
); | |
} | |
protected function setupAdditionalTraits($uses) | |
{ | |
foreach($uses as $trait) { | |
$method = 'setup' . class_basename($trait); | |
if (! method_exists($this, $method)) { | |
continue; | |
} | |
call_user_func([$this, $method]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment