12 use Zend\Http\Request;
23 public function testExecute()
27 $session = $this->_objectManager->get(Session::class);
31 $tokenManagement = $this->_objectManager->get(CustomerTokenManagement::class);
32 $tokens = $tokenManagement->getCustomerSessionTokens();
34 static::assertCount(1,
$tokens);
36 $vaultToken = array_pop(
$tokens);
39 $formKey = $this->_objectManager->get(FormKey::class);
42 'public_hash' => $vaultToken->getPublicHash(),
43 'form_key' => $formKey->getFormKey()
45 ->setMethod(Request::METHOD_POST);
46 $this->dispatch(
'vault/cards/deleteaction');
48 static::assertTrue($this->
getResponse()->isRedirect());
49 static::assertRedirect(static::stringContains(
'vault/cards/listaction'));
50 static::assertSessionMessages(static::equalTo([
'Stored Payment Method was successfully removed']));
51 static::assertEmpty($tokenManagement->getCustomerSessionTokens());