예제 #1
0
 /**
  * Get content.
  *
  * @param array $additionalContent
  * @param array $keys
  * @return array
  */
 public function getContent(array $additionalContent = null, array $keys = null)
 {
     $content = $this->contentProviderManager->getContent($keys);
     if ($additionalContent) {
         $content = array_merge($content, $additionalContent);
     }
     if ($keys) {
         $content = array_intersect_key($content, array_combine($keys, $keys));
     }
     return $content;
 }
 public function testGetContentKeys()
 {
     $testContentProviderOne = $this->getMockBuilder('Oro\\Bundle\\UIBundle\\ContentProvider\\ContentProviderInterface')->setMethods(array('setEnabled', 'isEnabled', 'getName', 'getContent'))->getMockForAbstractClass();
     $testContentProviderOne->expects($this->once())->method('setEnabled')->with(true);
     $testContentProviderOne->expects($this->never())->method('isEnabled');
     $testContentProviderOne->expects($this->atLeastOnce())->method('getName')->will($this->returnValue('test1'));
     $testContentProviderOne->expects($this->atLeastOnce())->method('getContent')->will($this->returnValue('test1_content'));
     $expected = array('test1' => 'test1_content');
     $this->manager->addContentProvider($testContentProviderOne, true);
     $this->assertEquals($expected, $this->manager->getContent(array('test1')));
 }