-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a crude exception handling & a few other unit tests.
- Loading branch information
oldec
committed
Mar 27, 2018
1 parent
e112b2e
commit aa67e9f
Showing
4 changed files
with
133 additions
and
4 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
40 changes: 40 additions & 0 deletions
40
src/Oliverde8/Component/PhpEtl/Exception/ChainOperationException.php
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,40 @@ | ||
<?php | ||
|
||
namespace Oliverde8\Component\PhpEtl\Exception; | ||
use Throwable; | ||
|
||
/** | ||
* Class ChainException | ||
* | ||
* @author de Cramer Oliver<[email protected]> | ||
* @copyright 2018 Oliverde8 | ||
* @package Oliverde8\Component\PhpEtl | ||
*/ | ||
class ChainOperationException extends \Exception | ||
{ | ||
/** @var string */ | ||
protected $chainOperationName; | ||
|
||
/** | ||
* ChainOperationException constructor. | ||
* | ||
* @param string $message | ||
* @param int $code | ||
* @param Throwable|null $previous | ||
* @param string $chainOperationName | ||
*/ | ||
public function __construct($message = "", $code = 0, \Exception $previous = null, $chainOperationName = '') | ||
{ | ||
$this->chainOperationName = $chainOperationName; | ||
|
||
parent::__construct($message, $code, $previous); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getChainOperationName() | ||
{ | ||
return $this->chainOperationName; | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
/** | ||
* File Test.php | ||
* | ||
* @author de Cramer Oliver<[email protected]> | ||
* @copyright 2018 Smile | ||
*/ | ||
|
||
namespace Oliverde8\Component\PhpEtl\Tests\Item; | ||
|
||
|
||
use Oliverde8\Component\PhpEtl\Item\ChainBreakItem; | ||
use Oliverde8\Component\PhpEtl\Item\DataItemInterface; | ||
use Oliverde8\Component\PhpEtl\Item\GroupedItem; | ||
|
||
class GetMethodTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function testGroupedItem() | ||
{ | ||
$groupedItem = new GroupedItem(new \ArrayIterator([])); | ||
$this->assertEquals(DataItemInterface::SIGNAL_DATA, $groupedItem->getMethod()); | ||
} | ||
|
||
public function testChainBreakItem() | ||
{ | ||
$groupedItem = new ChainBreakItem(); | ||
$this->assertEquals('chainBreak', $groupedItem->getMethod()); | ||
} | ||
} |