function testChangingOwnPasswordDeletesAllHashesAndMakesPersistent()
{
$subject = $this->user123;
$modifier = $this->user123;
$this->dbMock->expects($this->exactly(2))->method('deleteData');
// Here we can't make an expectation on mock_deleteAll because one
// of the calls deletes all, and another deletes only a single hash.
// We'd have to fix mock_deleteAll to handle it.
// @todo replace this with a real DB test
$this->dbMock->expects($this->once())->method('insertData')->will($this->returnCallback(array($this, 'mock_insertData')));
$this->svc = $this->getSvcWithCookie('notempty');
$this->svc->handlePasswordChange($subject, $modifier);
$this->assertSame($this->mockToken, $this->lastCookieSet->value);
$this->assertSame($this->mockToken, $this->session->get('code'));
}