N98\Magento\Command\Customer\DeleteCommandTest::testBatchDelete PHP Method

testBatchDelete() public method

public testBatchDelete ( )
    public function testBatchDelete()
    {
        $command = $this->getMockBuilder('\\N98\\Magento\\Command\\Customer\\DeleteCommand')->setMethods(array('deleteCustomer'))->disableOriginalConstructor()->getMock();
        $command->expects($this->exactly(2))->method('deleteCustomer')->will($this->onConsecutiveCalls(true, new \Exception('Failed to delete')));
        $refObject = new \ReflectionObject($command);
        $method = $refObject->getMethod('batchDelete');
        $method->setAccessible(true);
        $data = new \ArrayIterator(array($this->customerModel, $this->customerModel));
        $collection = $this->getCustomerCollection(array('getIterator'));
        $collection->expects($this->once())->method('getIterator')->will($this->returnValue($data));
        $result = $method->invokeArgs($command, array($collection));
        $this->assertEquals(1, $result);
    }