How will one make an unit test in PHP if an ORM layer is used?

I have a class let's say Person. The ORM layer has generated based on the sql structure the corresponding objects. The class person has a method: Get($id). In the Get method, the object Person is called and the field from the table are retrieved.

I basically want to make the following unit test: create a new person and check if the Get method is returning the right information.

  • How is the unit testing supposed to work in this condition ?
  • Нужно ли мне создавать отдельную базу данных (только структуру) и делать создание / выбор из этой базы данных?
  • Должен ли файл boostrap загружать ту же конфигурацию, что и используемый мной фреймворк, но изменить файл конфигурации, чтобы он работал с поддельной базой данных?
  • Должен ли я очищать новую базу данных каждый раз после каждого теста?
  • Я также бродил, увидев ваши ответы, если моделирование ответа ORM без фактического создания новой базы данных не подходит?

    7
    задан danidacar 5 April 2011 в 07:39
    поделиться