Hello guys,
I've seen there is a WebTestCase class under Symfony\Bundle
\FrameworkBundle\Test which is intended to be used for controller's
actions tests. I'm using MongoDB and I've been writing unit tests for
objects that are mapped to MongoDB documents. I've seen that MongoDB
itself has Doctrine\ODM\MongoDB\Tests\BaseTest class that can be used
for that.
What I've found is that we need a Kernel instance in order to get the
proper classes/drivers used by the ODM (also paths to the hydrators/
proxies cache folder, etc.).
I managed to do it by extending WebTestCase and using something like:
public function setUp()
{
$this->createClient();
$this->dm = $this->kernel->getContainer()-
>get('doctrine.odm.mongodb.document_manager');
}
public function tearDown()
{
if ($this->dm) {
foreach ($this->dm->getDocumentDatabases() as $db) {
foreach ($db->listCollections() as $collection) {
$collection->drop();
}
}
$this->dm->getConnection()->close();
}
}
But this solution is kind of dirty, rather I'd like to have a
UnitTestCase class. My question is, how would you write a test for
it?, Is there any we can improve the framework in that sense?, please
give me some ideas and I work on the fix.
Mauricio.
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en