8 use \Magento\Framework\Convert\DataObject;
24 $mockFirst = $this->createPartialMock(\
Magento\Framework\DataObject::class, [
'getId',
'getCode']);
25 $mockFirst->expects($this->once())
27 ->will($this->returnValue(1));
28 $mockFirst->expects($this->once())
30 ->will($this->returnValue(
'code1'));
31 $mockSecond = $this->createPartialMock(\
Magento\Framework\DataObject::class, [
'getId',
'getCode']);
32 $mockSecond->expects($this->once())
34 ->will($this->returnValue(2));
35 $mockSecond->expects($this->once())
37 ->will($this->returnValue(
'code2'));
39 $callable =
function (
$item) {
40 return $item->getCode();
48 [
'value' => 1,
'label' =>
'code1'],
49 [
'value' => 2,
'label' =>
'code2'],
51 $this->assertEquals(
$result, $this->model->toOptionArray(
$items,
'id', $callable));
56 $mockFirst = $this->createPartialMock(\
Magento\Framework\DataObject::class, [
'getSome',
'getId']);
57 $mockFirst->expects($this->once())
59 ->will($this->returnValue(3));
60 $mockFirst->expects($this->once())
62 ->will($this->returnValue(
'code3'));
63 $mockSecond = $this->createPartialMock(\
Magento\Framework\DataObject::class, [
'getSome',
'getId']);
64 $mockSecond->expects($this->once())
66 ->will($this->returnValue(4));
67 $mockSecond->expects($this->once())
69 ->will($this->returnValue(
'code4'));
71 $callable =
function (
$item) {
72 return $item->getId();
83 $this->assertEquals(
$result, $this->model->toOptionHash(
$items, $callable,
'some'));
88 $object = new \stdClass();
90 $mockFirst = $this->createPartialMock(\
Magento\Framework\DataObject::class, [
'getData']);
91 $mockSecond = $this->createPartialMock(\
Magento\Framework\DataObject::class, [
'getData']);
93 $mockFirst->expects($this->any())
95 ->will($this->returnValue([
100 $mockSecond->expects($this->any())
102 ->will($this->returnValue([
108 'object' => $mockFirst,
109 'stdClass' => $object,
117 'o' =>
'*** CYCLE DETECTED ***',
127 $this->assertEquals(
$result, $this->model->convertDataToArray(
$data));