diff --git a/tests/bb-modules/Product/Api/AdminTest.php b/tests/bb-modules/Product/Api/AdminTest.php index 51c07bc96..f6df2e6ad 100644 --- a/tests/bb-modules/Product/Api/AdminTest.php +++ b/tests/bb-modules/Product/Api/AdminTest.php @@ -206,7 +206,11 @@ class AdminTest extends \PHPUnit_Framework_TestCase { $serviceMock->expects($this->atLeastOnce()) ->method('createProduct') ->will($this->returnValue($newProductId)); - + $di = new \Box_Di(); + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); + $this->api->setDi($di); $this->api->setService($serviceMock); $result = $this->api->prepare($data); @@ -324,6 +328,11 @@ class AdminTest extends \PHPUnit_Framework_TestCase { ->method('createAddon') ->will($this->returnValue($newAddonId)); + $di = new \Box_Di(); + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); + $this->api->setDi($di); $this->api->setService($serviceMock); @@ -550,6 +559,9 @@ class AdminTest extends \PHPUnit_Framework_TestCase { $di = new \Box_Di(); $di['db'] = $dbMock; + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); $this->api->setService($serviceMock); $this->api->setDi($di); @@ -632,6 +644,11 @@ class AdminTest extends \PHPUnit_Framework_TestCase { ->method('createCategory') ->will($this->returnValue($newCategoryId)); + $di = new \Box_Di(); + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); + $this->api->setDi($di); $this->api->setService($serviceMock); $result = $this->api->category_create($data); diff --git a/tests/bb-modules/Product/Api/GuestTest.php b/tests/bb-modules/Product/Api/GuestTest.php index dd762ec0c..0e2262262 100644 --- a/tests/bb-modules/Product/Api/GuestTest.php +++ b/tests/bb-modules/Product/Api/GuestTest.php @@ -83,6 +83,11 @@ class GuestTest extends \PHPUnit_Framework_TestCase { ->method('toApiArray') ->will($this->returnValue(array())); + $di = new \Box_Di(); + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); + $this->api->setDi($di); $this->api->setService($serviceMock); $result = $this->api->get($data); $this->assertInternalType('array', $result); @@ -104,6 +109,11 @@ class GuestTest extends \PHPUnit_Framework_TestCase { ->method('toApiArray') ->will($this->returnValue(array())); + $di = new \Box_Di(); + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); + $this->api->setDi($di); $this->api->setService($serviceMock); $result = $this->api->get($data); $this->assertInternalType('array', $result); @@ -121,7 +131,11 @@ class GuestTest extends \PHPUnit_Framework_TestCase { $serviceMock->expects($this->atLeastOnce()) ->method('findOneActiveBySlug') ->will($this->returnValue($model )); - + $di = new \Box_Di(); + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); + $this->api->setDi($di); $this->api->setService($serviceMock); $this->setExpectedException('\Box_Exception', 'Product not found'); @@ -187,6 +201,9 @@ class GuestTest extends \PHPUnit_Framework_TestCase { $di = new \Box_Di(); $di['db'] = $dbMock; + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); $this->api->setDi($di); @@ -206,7 +223,9 @@ class GuestTest extends \PHPUnit_Framework_TestCase { $di = new \Box_Di(); $di['db'] = $dbMock; - + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); $this->api->setDi($di); $arr = array( @@ -237,7 +256,9 @@ class GuestTest extends \PHPUnit_Framework_TestCase { $di = new \Box_Di(); $di['db'] = $dbMock; - + $di['array_get'] = $di->protect(function (array $array, $key, $default = '') use ($di) { + return isset ($array[$key]) ? $array[$key] : $default; + }); $this->api->setDi($di); $arr = array(