Beispiel #1
0
 /**
  * @covers \Magento\Framework\View\Design\Theme\Label::getLabelsCollection
  */
 public function testGetLabelsCollection()
 {
     /** @var $expectedCollection \Magento\Core\Model\Resource\Theme\Collection */
     $expectedCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\Theme\\Label\\ListInterface');
     $expectedItemsCount = count($expectedCollection->getLabels());
     $labelsCollection = $this->_model->getLabelsCollection();
     $this->assertEquals($expectedItemsCount, count($labelsCollection));
     $labelsCollection = $this->_model->getLabelsCollection('-- Please Select --');
     $this->assertEquals(++$expectedItemsCount, count($labelsCollection));
 }
Beispiel #2
0
 public function testGetLabelsCollectionForSystemConfiguration()
 {
     $defaultLabel = (string) new \Magento\Framework\Phrase('-- No Theme --');
     $data = ['value' => '1', 'label' => 'Label1'];
     $this->labelList->expects($this->once())->method('getLabels')->willReturn([$data]);
     $result = $this->model->getLabelsCollectionForSystemConfiguration();
     $this->assertTrue(is_array($result));
     $this->assertEquals(2, count($result));
     $this->assertEquals($defaultLabel, $result[0]['label']);
     $this->assertEquals($data['label'], $result[1]['label']);
 }
Beispiel #3
0
 /**
  * Return labels collection array
  *
  * @param bool|string $label add empty values to result with specific label
  * @return array
  */
 public function getLabelsCollection($label = false)
 {
     $options = parent::getLabelsCollection();
     if ($label) {
         array_unshift($options, ['value' => 0, 'label' => $label]);
     }
     return $options;
 }
Beispiel #4
0
 /**
  * Retrieve All Design Theme Options
  *
  * @param bool $withEmpty add empty (please select) values to result
  * @return Label[]
  */
 public function getAllOptions($withEmpty = true)
 {
     $label = $withEmpty ? __('-- Please Select --') : $withEmpty;
     return $this->_options = $this->themeLabel->getLabelsCollection($label);
 }