PHPUnit: Assert (and mock) that a method for consecutive calls

I’m testing a class that is calling a method twice and with different parameters. I want to assert that this method (addSourceLinkAndUpdateCounts) is called twice and with the expected parameters.

The matcher to use is the “InvokedAtIndex”. See PHPUnit 3.6 documentation 

Here and example (the method addSourceLinkAndUpdateCounts is mocked and I assert that is called twice with specific arguments)

// assert save function is called twice and with the two args
        $this->object
             ->expects($this->exactly(2))
             ->method('addSourceLinkAndUpdateCounts')
        ;

        // assert calls return the two links
        $this->object
             ->expects($this->at(1))
             ->method('addSourceLinkAndUpdateCounts')
             ->with('http://www.link1.com', 12) //assert 2nd only
        ;

        $this->object
             ->expects($this->at(2))
             ->method('addSourceLinkAndUpdateCounts')
             ->with('http://www.link2.com', 12) //assert 2nd only
        ;