Ouzo\Tests\Mock\Mock::when PHP Метод

when() публичный статический Метод

public static when ( $mock )
    public static function when($mock)
    {
        return new WhenBuilder(self::extractMock($mock));
    }

Usage Example

 /**
  * @test
  */
 public function shouldThrowExceptionOnExecutionError()
 {
     //given
     Mock::when($this->pdoMock)->errorInfo()->thenReturn(array('HY000', '20102', 'Execution error'));
     $executor = new PDOPreparedStatementExecutor();
     //when
     CatchException::when($executor)->createPDOStatement($this->dbMock, 'sql', array(), 'sql string');
     //then
     CatchException::assertThat()->isInstanceOf('\\Ouzo\\DbException');
 }
All Usage Examples Of Ouzo\Tests\Mock\Mock::when