Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TwoPluginTest.php
Go to the documentation of this file.
1 <?php
7 
12 {
13  public function setUp()
14  {
16  [\Magento\Framework\Interception\Fixture\Intercepted::class => [
17  'plugins' => [
18  'first' => [
19  'instance' => \Magento\Framework\Interception\Fixture\Intercepted\FirstPlugin::class,
20  'sortOrder' => 10,
21  ], 'second' => [
22  'instance' => \Magento\Framework\Interception\Fixture\Intercepted\Plugin::class,
23  'sortOrder' => 20,
24  ]
25  ],
26  ]
27  ]
28  );
29 
30  parent::setUp();
31  }
32 
33  public function testPluginBeforeWins()
34  {
35  $subject = $this->_objectManager->create(\Magento\Framework\Interception\Fixture\Intercepted::class);
36  $this->assertEquals('<X><P:bX/></X>', $subject->X('test'));
37  }
38 
39  public function testPluginAroundWins()
40  {
41  $subject = $this->_objectManager->create(\Magento\Framework\Interception\Fixture\Intercepted::class);
42  $this->assertEquals('<F:Y>test<F:Y/>', $subject->Y('test'));
43  }
44 
45  public function testPluginAfterWins()
46  {
47  $subject = $this->_objectManager->create(\Magento\Framework\Interception\Fixture\Intercepted::class);
48  $this->assertEquals('<P:aZ/>', $subject->Z('test'));
49  }
50 
51  public function testPluginBeforeAroundWins()
52  {
53  $subject = $this->_objectManager->create(\Magento\Framework\Interception\Fixture\Intercepted::class);
54  $this->assertEquals('<F:V><F:bV/><F:V/>', $subject->V('test'));
55  }
56 
58  {
59  $subject = $this->_objectManager->create(\Magento\Framework\Interception\Fixture\Intercepted::class);
60  $this->assertEquals('<F:aW/>', $subject->W('test'));
61  }
62 }