Skip to content

Developping Environment

赵丰 (Zhao Feng) edited this page Jan 24, 2019 · 7 revisions

php module

After cloning the library, you need initializing the submodules explicitly. test.php also depends on phpunit.

wordpress database setup

the php codes interact with both the wechat server and local wordpress database. If the codes are run from command line, you should specify the environment vairable ABSPATH, which points to the installation path of wordpress.

test

install phpunit globally and run it at the repository root from shell.

phpunit tests

The testing process uses assets directory for cache.

You can use filter option to run a specific test:

phpunit tests\TeachTest.php --filter=TeachTest::test_sync_wechat_upload_image_false

cache

the html page is cached within asset directory. The file name is sha1(url), which is 40 character-length string. The url is first escaped by esc_url(wordpress utility function) and then replace http with https. Finally, it is passed to sha1 function to generate the file name.

The downloaded images are cached in similar ways. But currently, wsync_check_image_exists uses php brute force method, which is of low efficiency.

Clone this wiki locally