php - Phalcon: how to run example unit test? -


i tried run example here: http://docs.phalconphp.com/en/latest/reference/unit-testing.html

i created composer file:

{     "require": {         "phalcon/incubator": "dev-master"     } } 

after composer installation i've tried run phpunit , got error:

php fatal error:  class 'codeception\testcase\test' not found in /www/tests/vendor/phalcon/incubator/codeception/unit/phalcon/validation/validator/db/uniquenesstest.php on line 9 

i added new dependency:

composer require "codeception/codeception:*" 

it added many dependencies.

after got error:

php warning:  require_once(tests/data/app/data.php): failed open stream: no such file or directory in www/tests/vendor/codeception/codeception/tests/unit/codeception/module/facebooktest.php on line 3 

i changed

require_once(tests/data/app/data.php) 

to

require_once(__dir__ . '/../../../../tests/data/app/data.php') 

in follow follow files:

www/tests/vendor/codeception/codeception/tests/unit/codeception/module/webdrivertest.php www/tests/vendor/codeception/codeception/tests/unit/codeception/module/wfacebooktest.php www/tests/vendor/codeception/codeception/tests/unit/codeception/module/phpbrowsertest.php 

ok. phpunit running...i've got next error:

php fatal error:  class 'webdrivertestcase' not found in `www/tests/vendor/facebook/webdriver/tests/functional/basetest.php on line 16` 

ok.. tried include:

require_once __dir__ . '/webdrivertestcase.php'; 

to

www/tests/vendor/facebook/webdriver/tests/functional/basetest.php 

now have following error cannot fix:

php fatal error:  uncaught exception 'phpunit_framework_exception' message 'class "phpunit_extensions_repeatedtest" not extend phpunit_framework_testcase.' in www/tests/vendor/phpunit/phpunit/src/framework/testsuite.php:195 stack trace: #0 /www/tests/vendor/phpunit/phpunit/src/framework/testsuite.php(324): phpunit_framework_testsuite->__construct(object(reflectionclass)) #1 /www/tests/vendor/phpunit/phpunit/src/framework/testsuite.php(409): phpunit_framework_testsuite->addtestsuite(object(reflectionclass)) #2 /www/tests/vendor/phpunit/phpunit/src/framework/testsuite.php(435): phpunit_framework_testsuite->addtestfile('/users/anthony/...') #3 phar:///usr/local/zend/bin/phpunit/phpunit/util/configuration.php(911): phpunit_framework_testsuite->addtestfiles(array) #4 phar:///usr/local/zend/bin/phpunit/phpunit/util/configuration.php(825): phpunit_util_configura in /www/tests/unittestcase.php on line 61 

i thought composer should make life easer seems doesn't. ok have change code in vendor libraries?!... i'm doing wrong? need use phpunit in phalcon...

by time finished reading question expecting see "ok… took gun , shoot twice in stomach…" little uncertain if trying run tests incubator or phalcon, or own. assuming own.

first of incubator interesting repository, it's last thing need use in project. it's meant make life easier, stuff experimental there , act more inspiration rather solution (imho). it's supported less involved people , reason why doesn't work might difference in phpunit versions (incubator uses 3.7, rest of contemporary world uses 4.2, have incompatibilities).

phalcon works fine phpunit out of box. run basic tests need install , configure phpunit per documentation. simplest phpunit.xml can this:

<phpunit bootstrap="../../public/bootstrap.php">     <testsuite name="default">         <directory>../../src/php</directory>     </testsuite> </phpunit> 

i suggest rid of incubator (at least tests until configure phpunit) , follow standard documentation.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -