1.1

(see changelog for new features and BC breaks)
Instanciating a class through a variable value is (new $class()). What if
class ctor have arguments? Then you're screwed and need to override the
factory. That's why I think factory should contain hardcoded instanciation
of one given class.


2014-06-09 11:14 GMT+02:00 Antoine Guigan <notifications@github.com>:

> In spec/Akeneo/Component/SpreadsheetParser/Csv/RowIteratorFactorySpec.php:
>
> > @@ -0,0 +1,46 @@
> > +<?php
> > +
> > +namespace spec\Akeneo\Component\SpreadsheetParser\Csv;
> > +
> > +use PhpSpec\ObjectBehavior;
> > +
> > +class RowIteratorFactorySpec extends ObjectBehavior
> > +{
> > +    public function let()
> > +    {
> > +        $this->beConstructedWith(
> > +            'spec\Akeneo\Component\SpreadsheetParser\Csv\StubRowIterator'
>
> It is really easy to override, with the component and with the bundle. It
> also makes testing the factory easier. This is a design pattern, it is not
> hackish ;)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/akeneo/spreadsheet-parser/pull/3/files#r13533637>.
>



-- 
Gildas Quéméner