mrtnzlml-archive / testbench

:green_apple: Simple integration testing tool for Nette applications
http://zlml.cz/jednoduche-testovani-pro-uplne-kazdeho
41 stars 13 forks source link

TestbenchExtension: Rewritten setting of wrapperClass to OrmExtension #14

Closed foxycode closed 8 years ago

foxycode commented 8 years ago

If you have more sections like metadata or dql under doctrine config, wrapperClass was set to all of them which produces error in metadata, because that namespace doesn't exist.

Reather than ommiting metadata section I implemented checking, if particular section defines connection details and thus wrapperClass should be set there.

mrtnzlml commented 8 years ago

Can you please provide example of failing configuration or failing test case if possible? I cannot merge this PR without tests. I also have multiple sections and it seems fine to me.

foxycode commented 8 years ago

My configuration looks like this:

doctrine:
    metadata:
        App\Model\Entities: %appDir%/model/Entities
    types:
        convertabledatetime: App\Model\ConvertableDateTimeType
    dql:
        datetime:
            date:           Oro\ORM\Query\AST\Functions\SimpleFunction
            time:           Oro\ORM\Query\AST\Functions\SimpleFunction
            timestamp:      Oro\ORM\Query\AST\Functions\SimpleFunction
            convert_tz:     Oro\ORM\Query\AST\Functions\DateTime\ConvertTz
            timestampdiff:  Oro\ORM\Query\AST\Functions\Numeric\TimestampDiff
            dayofyear:      Oro\ORM\Query\AST\Functions\SimpleFunction
            dayofmonth:     Oro\ORM\Query\AST\Functions\SimpleFunction
            dayofweek:      Oro\ORM\Query\AST\Functions\SimpleFunction
            week:           Oro\ORM\Query\AST\Functions\SimpleFunction
            day:            Oro\ORM\Query\AST\Functions\SimpleFunction
            hour:           Oro\ORM\Query\AST\Functions\SimpleFunction
            minute:         Oro\ORM\Query\AST\Functions\SimpleFunction
            month:          Oro\ORM\Query\AST\Functions\SimpleFunction
            quarter:        Oro\ORM\Query\AST\Functions\SimpleFunction
            second:         Oro\ORM\Query\AST\Functions\SimpleFunction
            year:           Oro\ORM\Query\AST\Functions\SimpleFunction
        numeric:
            sign:           Oro\ORM\Query\AST\Functions\Numeric\Sign
            pow:            Oro\ORM\Query\AST\Functions\Numeric\Pow
        string:
            group_concat:   Oro\ORM\Query\AST\Functions\String\GroupConcat
            concat_ws:      Oro\ORM\Query\AST\Functions\String\ConcatWs
            cast:           Oro\ORM\Query\AST\Functions\Cast
    default:
        driver: pdo_mysql
        host: localhost
        user: xxx
        password: xxx
        dbname: xxx
    deals:
        driver: pdo_pgsql
        host: localhost
        user: xxx
        password: xxx
        dbname: xxx

Problem is, that on current implementation, wrapperClass is added to metadata section and Doctrine tries to find that namespace folder location, which of course don't exists. Similar problem if you add wrapperClass to types section.

mrtnzlml commented 8 years ago

Can you please test it (dev-master) so I can release new patch version? Thanks.

foxycode commented 8 years ago

@mrtnzlml Yes, it's working.

How you do that own commit with my commit in it?

mrtnzlml commented 8 years ago

GitHub is clever. If I edit and merge this commit localy, he knows that it's based on your work and gives you all credits... :) I am only merge master at this moment.

Version v2.0.3 has been released. Thank you for your time, I really appreciate it.