Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

How to execute unit tests? #45

Open
bschmitt opened this issue Feb 5, 2018 · 3 comments
Open

How to execute unit tests? #45

bschmitt opened this issue Feb 5, 2018 · 3 comments

Comments

@bschmitt
Copy link

bschmitt commented Feb 5, 2018

I want to use Tx_PtExtbase_Tests_Unit_AbstractBaseTestcase for my extbase extension unit tests too but I'm struggling to:
a) execute the pt_extbase unit tests
b) execute unit tests of my extension which are based on the abstract class.

typo3src/bin/phpunit -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/pt_extbase/Tests/Unit/

Any help appreciated (TYPO3 6.2)

@Stefan-Kosker
Copy link
Contributor

Stefan-Kosker commented Feb 6, 2018

Hello,

I use phpunit as follows:
-php location- -phpunit location- -config.xml location- -tests location-
example:
/usr/bin/php vendor/bin/phpunit --configuration web/typo3conf/ext/drotalion_test_extension/Configuration/PhpUnit/UnitTests.xml web/typo3conf/ext/drotalion_extension/Tests/Unit

I quite don't understand your question though. Do you want to execute all tests, which inherits from AbstractBaseTestcase?

Have a nice day

@bschmitt
Copy link
Author

bschmitt commented Feb 6, 2018

Thanks for your answer!
Can you show me how your UnitTests.xml looks like?

The problem is that my extension unit tests can't find Tx_PtExtbase_Tests_Unit_AbstractBaseTestcase. Regarding my question in a) I wanted to know how the pt_extbase unit tests can be executed to prove if my PHPUnit setup with composer etc is correct. I find it really hard to get any documentation regarding extbase unit tests in 6.2 and how to execute them.

@Stefan-Kosker
Copy link
Contributor

Stefan-Kosker commented Feb 7, 2018

Hey,

I can't ensure that it works with 6.2, I am using 7.6 here. My XML file is nothing special, looks like this:

<?xml version="1.0"?>
<phpunit processIsolation="false">
	<testsuites>
		<testsuite name="Drotalion TYPO3 Unit Tests">
			<directory suffix="Test.php">../../../../drotalion_*/Tests/Unit</directory>
		</testsuite>
	</testsuites>
  <logging>
    <log type="junit" target="../../../../../../../build/logs/UnitTests.xml" logIncompleteSkipped="false"/>
  </logging>
	<php>
		<var name="UNIT_TEST_DOMAIN" value="<your url>" />
	</php>
</phpunit>

Question: You prob. use php 56 with typo3 6.2. Which Phpunit version are you using (according to your composer)? I can ensure, that phpunit 4.x works fine with php56. According to phpunit homepage also phpunit 5.x

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants