» How to set up Doctrine2 fixtures when testing with PHPUnit?
How to set up Doctrine2 fixtures when testing with PHPUnit?
|July 8, 2011
Posted by forumadmin
I’m trying to get started with Symfony2 and have been trying to set up automated testing for the model layer of my application. The Symfony2 book talks about unit testing for controllers but I can’t find many examples of model testing.
I would like to have a clean data set to work with before each test runs and found these articles:
Based on the sznapka.pl article I have a test actually running without errors, but although the test schema is created the fixtures don’t load. I can’t see why, or even a way to debug this.
Background: I’ve previously worked with CakePHP where the loading of fixtures is largely handled automatically, maybe I have the wrong approach for Symfony/Doctrine?
More Related Questions
- Assembly.GetEntryAssembly().CodeBase precludes unit testing I'm writing a logging library. I want the library, by default, to write to a directory in the common application data folder named for the application. For example, if the application is […]
- How to set up database-heavy unit tests in Symfony2 using PHPUnit? I am quite new to the world of testing and I want to make sure I am on the right track.
I am trying to setup unit tests in a symfony2 project using phpunit.
PHPUnit is functional and the […]
- Unit testing (ZF2) controllers which process forms and (doctrine 2) entities I'm having difficulties writing tests for my Zend Framework 2 controllers: (although, this could be generalized to other frameworks)
I have controllers which process forms that do CRUD […]
- How to Create Dynamic Entity Association with Doctrine2 in Symfony2 I am building a CMS, with dynamic routing. So I have a Routing entity which stores one or more URLs that point to a View entity. The View entity defines basic page information (e.g. title, […]
- Symfony2 fixtures from DB? Is it possible to generate fixtures from an existing DB in Symfony2/Doctrine? How could I do that?
I have defined 15 entities and my symfony2 app is working. Now some people are […]
- Symfony2 Custom form type using entity trying to test it I am trying to test a form type I have creating that uses a field with class entity
here is the creation of the form
- How to update particular image related data using doctrine entity with one to many relationship in Symfony 2 I have two entities (namely Book, Image) having OneToMany relationship between them, i.e. One book can have more than one images.
Now when I am trying to edit the details of the book, how […]
- Symfony 2 object with array of objects, how to access them? I have 3 Symfony2 entities that are related in the following way:
A Vehicle with Plate Number, make, model. Also the vehicle has many Jobs and Fuel Purchases
Job has a method that gives […]
- Best Practices for developing a multi-tenant application with Symfony2 and Doctrine2 I am working on an application that needs to support the multi-tenant model. I am using the symfony2 php framework and doctrine2.
I'm not sure the best way to go about architecting this […]
- Symfony 2.3: CollectionRegionDoctrineCommand not found when update vendors and clear cache Everything worked fine until I actualize the vendors.
Then when I clean the cache I get the following error:
PHP Fatal error: Class