logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
Can someone post a full working example of Lime 2 annotations?

I just upgraded to Lime 2 and I'm trying to write a functional test that uses annotations. I'm doing something wrong - its as if the annotations never get called. Can someone please post a working example, so I can see how its done?

Update: So, maybe this feature isn't used much? Can anyone post an actual example that they've written?

This question has been answered.

Lawrence Krubner | 02/23/10 at 8:39pm Edit


(4) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    02/25/10
    9:08pm
    Gordon Franke says:

    i think it is not a good idea to use lime 2. Symfony 2 will use phpunit as test framework see https://gist.github.com/309820/59a86f8637e9ce85c17daf57317922f597c4569e and Symfony 2 will came at the end of the year 2010 see http://www.slideshare.net/fabpot/symfony-20-revealed slide 130.

    You can also use PHPUnit in your symfony 1 projects see
    http://dev.esl.eu/blog/2010/02/25/testing-symfony-projects-with-phpunit/

    Previous versions of this answer: 02/25/10 at 6:55am | 02/25/10 at 6:56am | 02/25/10 at 6:56am

    • 02/25/10 5:21pm

      Lawrence Krubner says:

      Ah, that is frustrating. I initially resisted using Lime because I didn't want to learn another testing framework. Then, finally, 6 months ago, I decided I should use it because using it was the official Symfony way of doing things. Now it is going away?

      At least PHPUnit is solid.

  • avatar
    Last edited:
    02/24/10
    2:22am
    Christian Schaefer says:

    I have to second Gordon. Latest rumours show that Lime2 is dropped in favour of PHPUnit.
    However I have to point out that lime and Lime2 are both for unit testing not functions tests!

    For functional Tests you should use sfTestBrowser which has nothing to do with lime.

    More can be read here:
    http://webmozarts.com/2009/06/30/easy-unit-testing/
    http://www.symfony-project.org/blog/2009/11/10/lime-2-alpha-released

  • avatar
    Last edited:
    02/24/10
    7:35am
    szemian says:

    Just a guess, did you enable the annotation?


    require_once dirname(__FILE__).'/../boostrap/functional.php';
    LimeAnnotationSupport::enable();

  • avatar
    Last edited:
    02/25/10
    9:08pm
    Bernhard Schussek says:

    Hi Lawrence,

    First of all, I never tested Lime 2 with functional tests and annotations (yet). So I cannot tell you exactly whether that will work.

    To get Lime 2 working correctly with annotations, you need to do three things:

    1) Load the LimeAutoloader
    2) Register it
    3) Enable annotation support

    Then you are able to use annotations. Again, this is for unit tests, I'm not sure whether functional tests work out of the box with annotations. This was never tested by me.

    Example:


    require_once dirname(__FILE__).'/../../lib/LimeAutoloader.php';

    LimeAutoloader::register();
    LimeAnnotationSupport::enable();

    $t = new LimeTest(2);

    // @Before

    $fixture = new SomeClass();

    // @Test: SomeClass behaves correctly if 1 == 1

    $t->is($fixture->one(), 1, "1 is definitely 1");

    // @Test: If 1 is not 1, SomeClass throws a WeirdMathsException

    ...

    Previous versions of this answer: 02/24/10 at 3:25pm | 02/24/10 at 3:25pm

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.