-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karl DeBisschop
committed
Nov 25, 2020
1 parent
3623fc3
commit 17356a3
Showing
4 changed files
with
107 additions
and
45 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* @author Wizacha DevTeam <dev@wizacha.com> | ||
* @copyright Copyright (c) Wizacha | ||
* @copyright Copyright (c) Leonardo Marquine | ||
* @license MIT | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpEtl\GoogleAnalytics\Tests; | ||
|
||
use PHPUnit\Framework\TestCase as BaseTestCase; | ||
use Wizaplace\Etl\Loaders\Loader; | ||
use Wizaplace\Etl\Transformers\Transformer; | ||
|
||
/** | ||
* Class TestCase | ||
* | ||
* @package Tests | ||
*/ | ||
abstract class TestCase extends BaseTestCase | ||
{ | ||
|
||
/** | ||
* @param $step | ||
* @param $data | ||
*/ | ||
protected function execute($step, $data) | ||
{ | ||
if ($step instanceof Transformer) { | ||
$method = 'transform'; | ||
} | ||
|
||
if ($step instanceof Loader) { | ||
$method = 'load'; | ||
} | ||
|
||
$step->initialize(); | ||
|
||
foreach ($data as $row) { | ||
$step->$method($row); | ||
} | ||
|
||
$step->finalize(); | ||
} | ||
} |