/**
  * @test
  */
 public function magicCallMethodAcceptsCountBySomethingCallsAndExecutesAQueryWithThatCriteria()
 {
     $mockQueryResult = $this->getMock('Tx_Extbase_Persistence_QueryResultInterface');
     $mockQueryResult->expects($this->once())->method('count')->will($this->returnValue(2));
     $this->mockQuery->expects($this->once())->method('equals')->with('foo', 'bar')->will($this->returnValue('matchCriteria'));
     $this->mockQuery->expects($this->once())->method('matching')->with('matchCriteria')->will($this->returnValue($this->mockQuery));
     $this->mockQuery->expects($this->once())->method('execute')->will($this->returnValue($mockQueryResult));
     $this->assertSame(2, $this->repository->countByFoo('bar'));
 }