-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
php tests with composer setup (#284)
- Loading branch information
Showing
8 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Setup | ||
|
||
Make install for themis core lib | ||
``` | ||
git clone https://github.com/cossacklabs/themis.git | ||
cd themis | ||
sudo make install | ||
``` | ||
|
||
|
||
Make intstall for phpthemis | ||
|
||
``` | ||
cd tests/phpthemis | ||
sudo make phpthemis_install | ||
``` | ||
|
||
# Unit tests | ||
|
||
|
||
You can use shell scripts for convenience | ||
``` | ||
composer_setup.sh # to setup PHP Composer | ||
# for PHP 5.6 | ||
init_env-php5.6.sh | ||
# for PHP 7.0+ | ||
init_env-php7.sh | ||
``` | ||
|
||
Or proceed manually. | ||
|
||
Install Composer locally | ||
|
||
```console | ||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | ||
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | ||
php composer-setup.php | ||
php -r "unlink('composer-setup.php');" | ||
|
||
``` | ||
|
||
Check you current php version | ||
```console | ||
# to see current state | ||
update-alternatives --display php | ||
# to list all options | ||
update-alternatives --list php | ||
# to set the very one | ||
sudo update-alternatives --set php <path_to_php> | ||
``` | ||
|
||
Link version specific composer config | ||
```console | ||
ln -s composer-php<version>.json composer.json | ||
``` | ||
|
||
Update environment | ||
```console | ||
php composer.phar update | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "tests/phpthemis/php-5.6", | ||
"description": "Some stuff for tests", | ||
"autoload": { | ||
"classmap": [ | ||
"src/" | ||
] | ||
}, | ||
"require": { | ||
"php": "^5.6", | ||
"phpunit/phpunit": "^5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "tests/phpthemis/php-7", | ||
"description": "Some stuff for tests", | ||
"autoload": { | ||
"classmap": [ | ||
"src/" | ||
] | ||
}, | ||
"require": { | ||
"php": "^7", | ||
"phpunit/phpunit": "^6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash -e | ||
|
||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | ||
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | ||
php composer-setup.php | ||
php -r "unlink('composer-setup.php');" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash -e | ||
|
||
rm composer.json | ||
ln -s composer-php5.6.json composer.json | ||
php composer.phar update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash -e | ||
|
||
rm composer.json | ||
ln -s composer-php7.json composer.json | ||
php composer.phar update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -e | ||
|
||
echo -e "\n >>>> secure cell tests <<<<\\n" | ||
./vendor/phpunit/phpunit/phpunit scell_test.php | ||
echo -e "\n >>>> secure message tests <<<<\n" | ||
./vendor/phpunit/phpunit/phpunit smessage_test.php | ||
echo -e "\n >>>> secure token tests <<<<\n" | ||
# todo: | ||
./vendor/phpunit/phpunit/phpunit ssession_test.php |