Exemplo n.º 1
0
 public function testLoadPreferences()
 {
     $config = new \SimpleXMLElement('<config><global><forgery>
         <preference>
             <old>Magelight\\Blocks\\Body</old>
             <new>App\\Blocks\\Body</new>
         </preference>
         <preference>
             <old>Magelight\\Blocks\\Header</old>
             <new>App\\Blocks\\Header</new>
         </preference>
         <preference>
             <old>Magelight\\Blocks\\Footer</old>
             <new>App\\Blocks\\Footer</new>
         </preference>
         <preference>
             <old>App\\Blocks\\Footer</old>
             <new>App\\Blocks\\FooterExtended</new>
             <interface>App\\Blocks\\FooterInterface</interface>
         </preference>
     </forgery></global></config>');
     $config = (array) $config->xpath('//config/global/forgery/preference');
     $this->forgery->loadPreferences($config);
     $this->assertEquals('App\\Blocks\\Header', $this->forgery->getClassName('Magelight\\Blocks\\Header'));
     $this->assertEquals('App\\Blocks\\Body', $this->forgery->getClassName('Magelight\\Blocks\\Body'));
     $this->assertEquals('App\\Blocks\\FooterExtended', $this->forgery->getClassName('Magelight\\Blocks\\Footer'));
     $this->assertEquals(['App\\Blocks\\FooterInterface'], $this->forgery->getClassInterfaces('App\\Blocks\\FooterExtended'));
 }
Exemplo n.º 2
0
 /**
  * Get Forgery instance
  *
  * @return \Magelight\Forgery
  */
 public static function getForgery()
 {
     return \Magelight\Forgery::getInstance();
 }