コード例 #1
0
ファイル: ValidatorPoolTest.php プロジェクト: kid17/magento2
 public function testGetException()
 {
     $this->setExpectedException('Magento\\Framework\\Exception\\NotFoundException');
     $tMap = $this->getMockBuilder('Magento\\Framework\\ObjectManager\\TMap')->disableOriginalConstructor()->getMock();
     $tMap->expects(static::once())->method('offsetExists')->with('validator')->willReturn(false);
     $pool = new ValidatorPool($tMap);
     $pool->get('validator');
 }
コード例 #2
0
 public function testGetException()
 {
     $this->setExpectedException('Magento\\Framework\\Exception\\NotFoundException');
     $tMapFactory = $this->getMockBuilder('Magento\\Framework\\ObjectManager\\TMapFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $tMap = $this->getMockBuilder('Magento\\Framework\\ObjectManager\\TMap')->disableOriginalConstructor()->getMock();
     $tMapFactory->expects(static::once())->method('create')->with(['array' => [], 'type' => 'Magento\\Payment\\Gateway\\Validator\\ValidatorInterface'])->willReturn($tMap);
     $tMap->expects(static::once())->method('offsetExists')->with('validator')->willReturn(false);
     $pool = new ValidatorPool([], $tMapFactory);
     $pool->get('validator');
 }