Skip to content

Commit

Permalink
Uses checkClass() method
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Aug 2, 2018
1 parent 1d6a939 commit 65864b7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 18 deletions.
5 changes: 1 addition & 4 deletions lib/custom/setup/unittest/CustomerAddLaravelTestData.php
Expand Up @@ -30,10 +30,7 @@ public function getPreDependencies()
*/
public function migrate()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if( !( $this->additional instanceof $iface ) ) {
throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
}
\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional );

$this->msg( 'Adding Laravel customer test data', 0 );
$this->additional->setEditor( 'ai-laravel:unittest' );
Expand Down
5 changes: 1 addition & 4 deletions lib/custom/setup/unittest/CustomerListAddLaravelTestData.php
Expand Up @@ -31,10 +31,7 @@ public function getPreDependencies()
*/
public function migrate()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if( !( $this->additional instanceof $iface ) ) {
throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
}
\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional );

$this->msg( 'Adding customer-list Laravel test data', 0 );
$this->additional->setEditor( 'ai-laravel:unittest' );
Expand Down
Expand Up @@ -32,10 +32,7 @@ public function getPreDependencies()
*/
public function migrate()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if( !( $this->additional instanceof $iface ) ) {
throw new \Aimeos\MW\Setup\Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
}
\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\MShop\\Context\\Item\\Iface', $this->additional );

$this->msg( 'Adding customer-property Laravel test data', 0 );
$this->additional->setEditor( 'ai-laravel:unittest' );
Expand Down
5 changes: 1 addition & 4 deletions lib/custom/src/MShop/Customer/Manager/Laravel.php
Expand Up @@ -288,10 +288,7 @@ public function getSearchAttributes( $withsub = true )
*/
public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
{
$iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface';
if( !( $item instanceof $iface ) ) {
throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
}
self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $item );

if( !$item->isModified() )
{
Expand Down
Expand Up @@ -46,7 +46,7 @@ public function testCreateItem()

public function testSaveInvalid()
{
$this->setExpectedException( '\Aimeos\MShop\Exception' );
$this->setExpectedException( '\Aimeos\MW\Common\Exception' );
$this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() );
}

Expand Down
Expand Up @@ -83,7 +83,7 @@ public function testGetItem()

public function testSaveInvalid()
{
$this->setExpectedException( '\Aimeos\MShop\Exception' );
$this->setExpectedException( '\Aimeos\MW\Common\Exception' );
$this->object->saveItem( new \Aimeos\MShop\Locale\Item\Standard() );
}

Expand Down

0 comments on commit 65864b7

Please sign in to comment.