Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to run tests. #11

Closed
AlexeyKupershtokh opened this issue Jul 31, 2015 · 7 comments
Closed

Document how to run tests. #11

AlexeyKupershtokh opened this issue Jul 31, 2015 · 7 comments

Comments

@AlexeyKupershtokh
Copy link
Contributor

I've tried to run phpunit tests.
First I couldn't run just the phpunit, which is usually just enough: it couldn't find the file for require_once $_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';.
Then I found the build.xml file and run it:

wicked@w:~/Alawar/F2P/gitolite/ThriftBundle $ phing -Dws=. prepare phpunit -verbose
Buildfile: /home/wicked/Alawar/F2P/gitolite/ThriftBundle/build.xml
Override ignored for user property phing.file
Override ignored for user property phing.dir
Overriding previous definition of reference to phing.file
parsing buildfile build.xml
Project base dir set to: /home/wicked/Alawar/F2P/gitolite/ThriftBundle
Property ${ws} => .
Build sequence for target 'prepare' is: prepare 
Complete build sequence is: prepare  clean phpdoc phpcpd pdepend phpcs phpunit 

OverblogThriftBundle > prepare:

     [echo] Prepare...
Property ${builddir} => ./build
Property ${builddir} => ./build
Property ${builddir} => ./build
    [mkdir] Created dir: /home/wicked/Alawar/F2P/gitolite/ThriftBundle/build/logs/coverage
Property ${builddir} => ./build
    [mkdir] Created dir: /home/wicked/Alawar/F2P/gitolite/ThriftBundle/build/docs
Property ${ws} => .
     [exec] Executing command: git submodule update --init 2>&1
Build sequence for target 'phpunit' is: phpunit 
Complete build sequence is: phpunit  clean prepare phpdoc phpcpd pdepend phpcs 

OverblogThriftBundle > phpunit:

     [echo] PHP Unit...
Property ${builddir} => ./build
Property ${builddir} => ./build
Property ${builddir} => ./build
     [exec] Executing command: phpunit -c . --log-junit ./build/logs/phpunit.xml --coverage-clover ./build/logs/coverage/clover.xml --coverage-html ./build/logs/coverage/ 2>&1
     [exec] PHPUnit 3.7.28 by Sebastian Bergmann.
     [exec] 
     [exec] The Xdebug extension is not loaded. No code coverage will be generated.
     [exec] 
     [exec] 
     [exec] PHP Fatal error:  Class 'ThriftModel\Test\TestServiceClient' not found in /home/wicked/Alawar/F2P/gitolite/ThriftBundle/Factory/ThriftFactory.php on line 68

BUILD FINISHED

Total time: 0.3059 seconds

Am I still missing something? How it's supposed to compile the models prior to run tests?

@xkobal
Copy link
Contributor

xkobal commented Jul 31, 2015

To run Unit test, you just have to run "git submodule update --init" before. Symfony is loaded as a submodule (that was done before composer)

Then you have to run: phing prepare phpunit

The error you have may mean that there was an error compiling the TestService Definition

@AlexeyKupershtokh
Copy link
Contributor Author

Ok, git submodule update --init seems to be run by phing prepare.

The error you have may mean that there was an error compiling the TestService Definition

Any idea how to overcome this?

@xkobal
Copy link
Contributor

xkobal commented Jul 31, 2015

Is your Thrift binary located in "/usr/local/bin/" directory ?

@AlexeyKupershtokh
Copy link
Contributor Author

wicked@w:~ $ which thrift
/usr/bin/thrift

This is default installation path on ubuntu:

wicked@w:~ $ dpkg-query -L thrift-compiler
/.
/usr
/usr/bin
/usr/bin/thrift
/usr/share
/usr/share/doc
/usr/share/doc/thrift-compiler
/usr/share/doc/thrift-compiler/changelog.gz
/usr/share/doc/thrift-compiler/copyright
/usr/share/doc/thrift-compiler/README.md.gz

@xkobal
Copy link
Contributor

xkobal commented Jul 31, 2015

That's the point. Maybe just create a symlink and it will work

@AlexeyKupershtokh
Copy link
Contributor Author

Ok, that trick helped. I don't like it though. It's probably better to avoid fixed paths even in tests.

I have got another error from phpunit:

     [echo] PHP Unit...
Property ${builddir} => ./build
Property ${builddir} => ./build
Property ${builddir} => ./build
     [exec] Executing command: phpunit -c . --log-junit ./build/logs/phpunit.xml --coverage-clover ./build/logs/coverage/clover.xml --coverage-html ./build/logs/coverage/ 2>&1
     [exec] PHPUnit 3.7.28 by Sebastian Bergmann.
     [exec] 
     [exec] The Xdebug extension is not loaded. No code coverage will be generated.
     [exec] 
     [exec] 
     [exec] .F.......
     [exec] 
     [exec] Time: 2.69 seconds, Memory: 7.75Mb
     [exec] 
     [exec] There was 1 failure:
     [exec] 
     [exec] 1) Overblog\ThriftBundle\Tests\Client\ThriftClientTest::testSocketClient__NoServer
     [exec] Failed asserting that exception message 'TSocket: Could not connect to localhost:9090 (Connection refused [111])' contains 'TSocket: Could not connect to localhost:9090 (Connexion refusée [111])'.
     [exec] 
     [exec] 
            FAILURES!
            Tests: 9, Assertions: 42, Failures: 1.

Are these messages really localized? If so, could we make two separate assertions:

  1. the message contains "TSocket: Could not connect to localhost:9090"
  2. the message contains "[111]"
    ?

@mcg-web mcg-web mentioned this issue Oct 23, 2016
8 tasks
@mcg-web
Copy link
Member

mcg-web commented Oct 24, 2016

I'm closing this issue, we can now use phpunit to test project without phing... Feel free to reopen if needed :)

@mcg-web mcg-web closed this as completed Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants