예제 #1
0
 public function testToOptionArray()
 {
     $expect = [['label' => __('-- Please Select a Category --'), 'value' => ''], ['label' => 'name', 'value' => 3]];
     $this->categoryCollection->expects($this->once())->method('addAttributeToSelect')->with($this->equalTo('name'))->will($this->returnValue($this->categoryCollection));
     $this->categoryCollection->expects($this->once())->method('addRootLevelFilter')->will($this->returnValue($this->categoryCollection));
     $this->categoryCollection->expects($this->once())->method('load');
     $this->categoryCollection->expects($this->any())->method('getIterator')->will($this->returnValue(new \ArrayIterator([$this->category])));
     $this->category->expects($this->once())->method('getName')->will($this->returnValue('name'));
     $this->category->expects($this->once())->method('getId')->will($this->returnValue(3));
     $this->assertEquals($expect, $this->model->toOptionArray());
 }