http://www.symfony-project.org/jobeet/1_4/Doctrine/en/08#chapter_08_doctrine_unit_tests
On Thu, Jul 22, 2010 at 18:36, Lene Preuss <lene.pre...@googlemail.com> wrote: > Yes, as I described above, this fails with a > Doctrine_Connection_Exception with message 'There is no open > connection': > > php ./test/unit/StoreTest.php > PHP Fatal error: Uncaught exception 'Doctrine_Connection_Exception' > with message 'There is no open connection' in lib/vendor/symfony/lib/ > plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Manager.php:662 > Stack trace: > #0 lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/ > Doctrine/Manager.php(557): Doctrine_Manager->getCurrentConnection() > #1 lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/ > Doctrine/Core.php(1095): Doctrine_Manager- >>getConnectionForComponent('Store') > #2 lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/ > Doctrine/Record.php(219): Doctrine_Core::getTable('Store') > #3 test/unit/StoreTest.php(9): Doctrine_Record->__construct() > #4 test/unit/StoreTest.php(51): StoreTestcase->__construct() > #5 {main} > thrown in lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/ > doctrine/Doctrine/Manager.php on line 662 > > This is kinda hard to decipher, as the mailing list breaks all lines > at 80 characters, sorry about that. but the message 'There is no open > connection' should be a hint. > > So I guess the real question is: How do I open a connection when > calling a test directly from the command line? What must I do first in > the test to open it? > > On Jul 22, 5:48 pm, Florian <sideral.undergro...@gmail.com> wrote: >> Hi! >> >> you normally can launch a test by doing : >> >> php test/unit/StoreTableTest.php >> >> By this way, you have the full output of your test script, even >> exceptions (dubious means script didn't ended as attended ( ie: fatal >> errors, uncaught exceptions, die(), ...). >> >> On 22 juil, 17:04, Lene Preuss <lene.pre...@googlemail.com> wrote: >> >> >> >> > Well no, I'm using lime, I just wrote a wrapper that makes the tests >> > look more like PHPUnit, indeed. ;-) >> >> > On Jul 22, 4:20 pm, Dennis <gear...@sbcglobal.net> wrote: >> >> > > Whoops! I was directed by google search to the middle of your article, >> > > and it LOOKED like you were using PHPUnit. My apologies. >> >> > > On Jul 22, 7:18 am, Dennis <gear...@sbcglobal.net> wrote: >> >> > > > I am hving great difficultities with PHPUnit and Symofny myself. If >> > > > you are doing any changes to the database out of band, you can forget >> > > > doing all your tests in one run. My next approach is to run my tests >> > > > (each with 15 assertions, in separate files. I will run them using a >> > > > bash script and redirect of all the tests's outputs to a single file. >> >> > > > For me, I'm foind that either symfony or PHPUnit is remembering things >> > > > from the last test that no longer exist. >> >> > > > I was at a talk by Dustin Whittle several weeks ago. He says PHPUnit >> > > > is the future of Symfony, albeit with some exetensions. They are >> > > > saving that part of Symfony 2 for last if I remember correctly. I >> > > > think they have their work cut out ofr them. >> >> > > > On Jul 22, 12:36 am, Lene Preuss <lene.pre...@googlemail.com> wrote: >> >> > > > > Hi there, >> >> > > > > any ideas, anybody? I'm kind of stuck here... >> >> > > > > Thanks, Lene >> >> > > > > On Jul 15, 6:55 pm, Lene Preuss <lene.pre...@googlemail.com> wrote: >> >> > > > > > Hi list, I'm a newb to symfony, so forgive me if I'm asking a dumb >> > > > > > question. >> >> > > > > > I jumped into symfony writing unit tests. My tests run fine when I >> > > > > > run >> > > > > > them as single test, e.g. >> >> > > > > > > php symfony test:unit Store >> >> > > > > > but they all fail with a 'dubious' status when I run them all, e.g. >> >> > > > > > > php symfony test:unit >> >> > > > > > StoreTableTest.......................................................dubiou >> > > > > > s >> > > > > > Test returned status 255 >> > > > > > Failed tests: 0 >> > > > > > StoreTest............................................................dubiou >> > > > > > s >> > > > > > Test returned status 255 >> > > > > > Failed tests: 0 >> > > > > > Failed Test Stat Total Fail Errors List of >> > > > > > Failed >> > > > > > -------------------------------------------------------------------------- >> > > > > > StoreTableTest 255 1 1 0 0 >> > > > > > StoreTest 255 1 1 0 0 >> > > > > > Failed 2/2 test scripts, 0.00% okay. 2/0 subtests failed, 0.00% >> > > > > > okay. >> >> > > > > > I read that the tests should be able to run standalone, which they >> > > > > > don't. E.g: >> >> > > > > > > php test/unit/StoreTest.php >> >> > > > > > PHP Fatal error: Uncaught exception >> > > > > > 'Doctrine_Connection_Exception' >> > > > > > with message 'There is no open connection' in >> > > > > > /var/home/lene/workspace/ >> > > > > > my.agfaphoto/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/ >> > > > > > vendor/doctrine/Doctrine/Manager.php:662 >> > > > > > Stack trace: >> > > > > > #0 /var/home/lene/workspace/my.agfaphoto/lib/vendor/symfony/lib/ >> > > > > > plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/ >> > > > > > Manager.php(264): Doctrine_Manager->getCurrentConnection() >> > > > > > #1 /var/home/lene/workspace/my.agfaphoto/test/unit/ >> > > > > > Testcase.class.php(59): Doctrine_Manager::connection() >> > > > > > #2 /var/home/lene/workspace/my.agfaphoto/test/unit/ >> > > > > > Testcase.class.php(20): Testcase::initData() >> > > > > > #3 >> > > > > > /var/home/lene/workspace/my.agfaphoto/test/unit/StoreTest.php(13): >> > > > > > Testcase->__construct() >> > > > > > #4 {main} >> > > > > > thrown in >> > > > > > /var/home/lene/workspace/my.agfaphoto/lib/vendor/symfony/ >> > > > > > lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Manager.php >> > > > > > on line 662 >> >> > > > > > I start each test by including dirname(__FILE__).'/../bootstrap/ >> > > > > > unit.php'. >> >> > > > > > What can I do to make testing all units at once work? >> >> > > > > > Thanks, >> >> > > > > > Lene > > -- > 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 users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- 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 users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en