Skip to content

Commit 41b97d4

Browse files
committed
travis test
1 parent bd62f35 commit 41b97d4

File tree

9 files changed

+114
-9
lines changed

9 files changed

+114
-9
lines changed

.travis.vhost

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<VirtualHost *:80>
2+
3+
DocumentRoot /var/www/html
4+
ServerName %VHOST_URL%
5+
6+
<Directory "/var/www/html">
7+
Options FollowSymLinks MultiViews ExecCGI
8+
AllowOverride All
9+
Order deny,allow
10+
Allow from all
11+
</Directory>
12+
13+
# Wire up Apache to use Travis CI's php-fpm.
14+
<IfModule mod_fastcgi.c>
15+
AddHandler php5-fcgi .php
16+
Action php5-fcgi /php5-fcgi
17+
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
18+
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
19+
</IfModule>
20+
21+
ErrorLog ${APACHE_LOG_DIR}/%VHOST_URL%.error.log
22+
CustomLog ${APACHE_LOG_DIR}/%VHOST_URL%.access.log common
23+
24+
</VirtualHost>

.travis.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
dist: trusty
2+
sudo: required
3+
language: php
4+
php:
5+
- 5.6
6+
7+
cache:
8+
directories:
9+
- $HOME/.m2
10+
- $HOME/.composer/cache
11+
12+
env:
13+
global:
14+
- JAVA_HOME=/usr/lib/jvm/java-8-oracle
15+
- VHOST_FILE=.travis.vhost
16+
- VHOST_CONF=travis.conf
17+
- VHOST_URL=wordpressjavatest.dev
18+
- SOURCE_DIR=src
19+
- VDIR=/var/www/html
20+
21+
services:
22+
- mysql
23+
24+
install:
25+
- sudo mkdir -p ${VDIR}
26+
- sudo chown -Rh www-data:travis ${VDIR}
27+
- sudo chmod -R a+rwx $VDIR
28+
- mysqladmin -u root password root
29+
- export PATH="/usr/local/bin:$PATH"
30+
- sudo apt-get -qq -y --force-yes install apache2 libapache2-mod-fastcgi php5-cli php5 php5-gd php5-mcrypt php5-readline php5-mysql php5-xdebug nullmailer
31+
- mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true -B -V
32+
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
33+
- sudo a2enmod rewrite actions fastcgi alias
34+
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
35+
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
36+
- phpenv config-rm xdebug.ini
37+
- sudo cp -f $VHOST_FILE /etc/apache2/sites-available/$VHOST_CONF
38+
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/$VHOST_CONF
39+
- sudo sed -e "s?%VHOST_URL%?$VHOST_URL?g" --in-place /etc/apache2/sites-available/$VHOST_CONF
40+
- echo "127.0.0.1 $VHOST_URL" | sudo tee -a /etc/hosts
41+
- sudo a2enmod rewrite
42+
- sudo a2ensite $VHOST_CONF
43+
- sudo service apache2 restart
44+
- mkdir -p ~/.wp-cli
45+
- curl -O https://github.com/raw/wp-cli/builds/gh-pages/phar/wp-cli.phar
46+
- chmod +x wp-cli.phar
47+
- sudo mv wp-cli.phar /usr/local/bin/wp
48+
- wp core download
49+
- wp --info
50+
- wp core config
51+
- wp db create
52+
- wp core install
53+
- wp user create testuser [email protected]
54+
- wp plugin install wordpress-importer --activate
55+
- wp media import $TRAVIS_BUILD_DIR/vagrant-test/Lenna.jpg
56+
- sudo chmod -R a+rwx $VDIR
57+
58+
script:
59+
- mvn test -B

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mvn package :
1919
This will create target zip and jar files under the 'target' directory.
2020

2121
You need to setup a dummy wordpress installation at
22-
http://wordpressjava-test.local. A Vagrant configuration is provided
22+
http://wordpressjavatest.local. A Vagrant configuration is provided
2323
in vagrant-test/ directory
2424

2525
DO NOT USE A PRODUCTION BLOG FOR TESTING. Tests are destructive.

src/net/bican/wordpress/example/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static void main(final String[] args)
3636
wp = new Wordpress(username, password, xmlRpcUrl);
3737
} else {
3838
wp = new Wordpress("admin", "admin",
39-
"http://wordpressjava-test.local/xmlrpc.php");
39+
"http://wordpressjavatest.local/xmlrpc.php");
4040
}
4141
final FilterPost filter = new FilterPost();
4242
filter.setNumber(10);

src/site/apt/index.apt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ java -jar target/jwordpress-<version>-cli.jar --user <user> --pass <pass> --url
5555
For example, here is how to get a list of users in the Wordpress installation:
5656

5757
+---------------------
58-
$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjava-test.local/xmlrpc.php -a
58+
$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjavatest.local/xmlrpc.php -a
5959
User_id:User_login:display_name
6060
admin:1:admin
6161
testuser:2:testuser
@@ -64,7 +64,7 @@ testuser:2:testuser
6464
You can get a list of all options using <<<-?>>> option:
6565

6666
+---------------------
67-
$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjava-test.local/xmlrpc.php -?
67+
$ java -jar target/jwordpress-0.6-cli.jar --user admin --pass admin --url http://wordpressjavatest.local/xmlrpc.php -?
6868
usage:
6969
-?,--help Print usage information
7070
-a,--authors Get author list

test/net/bican/wordpress/test/AbstractWordpressTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AbstractWordpressTest {
2020
static final String SITE_TAGLINE = "Site Tagline"; //$NON-NLS-1$
2121
static final String TEST_SITE = "test site"; //$NON-NLS-1$
2222
static final String TEST_SITE_TITLE = "test site title"; //$NON-NLS-1$
23-
public static String TOPURL = "http://wordpressjava-test.local.";
23+
public static String TOPURL = "http://wordpressjavatest.dev";
2424
public static String USERNAME = "admin";
2525
public static Wordpress WP;
2626
public static String XMLRPCURL = null;

vagrant-test/Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
99
config.vm.network "private_network", type: "dhcp"
1010
config.vm.provision :shell, :path => "install.sh"
1111
config.vm.synced_folder ".", "/var/www", owner: "www-data", group: "www-data"
12-
config.vm.hostname = "wordpressjava-test"
12+
config.vm.hostname = "wordpressjavatest"
1313
end

vagrant-test/install.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ then
1010
sudo apt-get install -y vim curl python-software-properties
1111
sudo add-apt-repository -y ppa:ondrej/php5
1212
sudo apt-get update
13-
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-readline mysql-server-5.5 php5-mysql git-core php5-xdebug avahi-daemon nullmailer
13+
sudo apt-get install -y apache2 libapache2-mod-fastcgi oracle-java8-set-default maven php5 php5-gd php5-mcrypt php5-readline mysql-server-5.5 php5-mysql php5-xdebug nullmailer
1414
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
1515
xdebug.scream=1
1616
xdebug.cli_color=1
1717
xdebug.show_local_vars=1
1818
EOF
19-
sudo a2enmod rewrite
2019
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
2120
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
2221
sed -i "s/disable_functions = .*/disable_functions = /" /etc/php5/cli/php.ini
@@ -46,7 +45,7 @@ rm -f /var/www/html/wp-config.php
4645
sudo -u www-data -- bash -c "cd /var/www/html; wp core config --dbuser=root --dbpass=root --dbname=blog"
4746
sudo -u www-data -- bash -c "cd /var/www/html; wp db drop --yes"
4847
sudo -u www-data -- bash -c "cd /var/www/html; wp db create"
49-
sudo -u www-data -- bash -c "cd /var/www/html; wp core install --url=wordpressjava-test.local --title=WordpressJavaTest --admin_user=admin --admin_password=admin [email protected]"
48+
sudo -u www-data -- bash -c "cd /var/www/html; wp core install --url=wordpressjavatest.local --title=WordpressJavaTest --admin_user=admin --admin_password=admin [email protected]"
5049
sudo -u www-data -- bash -c "cd /var/www/html; wp user create testuser [email protected]"
5150
sudo -u www-data -- bash -c "cd /var/www/html; wp plugin install wordpress-importer --activate"
5251
sudo -u www-data -- bash -c "cd /var/www/html; wp media import /var/www/Lenna.jpg"

wp-cli.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
path: /var/www/html
2+
url: wordpressjavatest.dev
3+
user: admin
4+
color: false
5+
6+
# Subcommand defaults (e.g. `wp config create`)
7+
config create:
8+
dbuser: root
9+
dbpass: root
10+
dbname: blog
11+
extra-php: |
12+
define( 'WP_DEBUG', true );
13+
define( 'WP_POST_REVISIONS', 50 );
14+
15+
core install:
16+
title: WordpressJavaTest
17+
admin_user: admin
18+
admin_password: admin
19+
admin_email: [email protected]
20+
skip-email:
21+
22+
_:
23+
merge: true

0 commit comments

Comments
 (0)