[FLOW3-general] Unit Testing
Christian Peters
mail.christianpeters at gmail.com
Thu Oct 18 15:06:52 CEST 2012
Okay, I got that with the BaseTestCase. What I do not understand is, that
you are creating the Class under Test via mocking as well, or did get that
wrong?
Normally I wouldn't create the class under test as mock ...
My phpunit call is (from flow root dir):
phpunit -c Build/buildessentials/PhpUnit/UnitTests.xml
And I get:
> PHP Fatal error: Cannot redeclare class Composer\Autoload\ClassLoader in
/Users/chp/Web/private/flow/Packages/Vendor/composer/ClassLoader.php on
line 44
Best Chris
On 16.10.12 09:26, Christian Peters wrote:
> - after rewieving some of the tests you've written, I wonder if you are
> using the AccessibleMock to create the class under test itself. I guess
> that's how you do dependency injection; but how is this a testable class
> then? Is there somewhere some information about this Accessible Mock?
Just check the BaseTestCase - an accessible mock is a regular PHPUnit
mock, with the added methods _call(), _callRef(), _set(), _setRef() and
_get() to access protected members.
For DI we recently added inject() to the BaseTestCase to make it even
easier.
> - I can't run the testsuite (phpunit claims that it can't redeclare
> Autoloader.php). I assume this is because phpunit uses the autoloader for
> itself. Is there any workaround for that or am I doing something wrong?
How are you running phpunit? Please show the command?
> - I want to write about TYPO3.Blog, as it's used throughout the docs. I
run
> the migrate Script and it resulted in a strange structure (essentially
> rebuilding the folder structure under /Classes). Is that correct? Is the
> Blog example up to date anyway or would it be a better idea to use a
> generic example?
Git tells me the Blog has been last updated in June. So, yes, it is
outdated. I hope Robert can push his updates, as he already uses it on a
current Flow setup.
Regards,
Karsten
--
Karsten Dambekalns
TYPO3 Core Developer, Neos / Flow Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list