Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:lucatume/idlikethis
# Conflicts: # .gitignore # composer.lock # tests/_data/dump.sql # tests/_support/_generated/AcceptanceTesterActions.php # tests/_support/_generated/FunctionalTesterActions.php # tests/_support/_generated/IntegrationTesterActions.php # tests/_support/_generated/UnitTesterActions.php # tests/integration/idlikethis/MetaBoxes/VotesDisplayMetaBoxTest.php
- Loading branch information
Showing
14 changed files
with
207 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
sudo: required | ||
|
||
language: php | ||
|
||
notifications: | ||
email: false | ||
|
||
php: | ||
- '5.6' | ||
- '7.0' | ||
|
||
services: | ||
- mysql | ||
|
||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
env: | ||
- wpDbName=test wpLoaderDbName=wploader wpDbPrefix=wp_ wpUrl=wordpress.dev wpAdminUsername=admin wpAdminPassword=admin | ||
|
||
before_install: | ||
- mysql -e "create database IF NOT EXISTS $wpDbName;" -uroot | ||
- mysql -e "create database IF NOT EXISTS $wpLoaderDbName;" -uroot | ||
|
||
install: | ||
- composer update --prefer-dist | ||
|
||
before_script: | ||
# set up folders | ||
- mkdir -p $HOME/tools /tmp/wordpress | ||
|
||
# install wp-cli | ||
- wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -P /tmp/tools/ | ||
- chmod +x /tmp/tools/wp-cli.phar && mv /tmp/tools/wp-cli.phar /tmp/tools/wp | ||
- export PATH=$PATH:/tmp/tools:vendor/bin | ||
|
||
# install Apache and WordPress setup scripts | ||
- git clone https://github.com/lucatume/travis-apache-setup.git /tmp/tools/travis-apache-setup | ||
- chmod +x /tmp/tools/travis-apache-setup/apache-setup.sh | ||
- chmod +x /tmp/tools/travis-apache-setup/wp-install.sh | ||
- ln -s /tmp/tools/travis-apache-setup/apache-setup.sh /tmp/tools/apache-setup | ||
- ln -s /tmp/tools/travis-apache-setup/wp-install.sh /tmp/tools/wp-install | ||
|
||
# download and install WordPress | ||
- wp-install --dir=/tmp/wordpress --dbname="$wpDbName" --dbuser="root" --dbpass="" --dbprefix=wp_ --domain="wordpress.dev" --title="Test" --admin_user=admin --admin_password=admin --admin_email=admin@wordpress.dev --theme=twentysixteen --empty | ||
- cd /tmp/wordpress | ||
|
||
# move the plugin into WordPress folder | ||
- mv $TRAVIS_BUILD_DIR /tmp/wordpress/wp-content/plugins/idlikethis | ||
- export PLUGIN_DIR="/tmp/wordpress/wp-content/plugins/idlikethis" | ||
|
||
# activate the plugin in WordPress | ||
- wp plugin activate idlikethis | ||
|
||
# flush rewrite rules | ||
- printf "apache_modules:\n\t- mod_rewrite" > /tmp/wordpress/wp-cli.yml | ||
- wp rewrite structure '/%postname%/' --hard | ||
|
||
# export a dump of the just installed database to the _data folder | ||
- cd /tmp/wordpress | ||
- wp db export $PLUGIN_DIR/tests/_data/dump.sql | ||
|
||
# set up Apache virtual host | ||
- sudo env "PATH=$PATH" apache-setup --host="127.0.0.1" --url="$wpUrl" --dir="/tmp/wordpress" | ||
|
||
# Get back to the plugin dir | ||
- cd $PLUGIN_DIR | ||
|
||
script: | ||
- codecept run -vvv |
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
File renamed without changes.
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
File renamed without changes.
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,25 @@ | ||
# Codeception Test Suite Configuration | ||
|
||
# suite for WordPress acceptance tests. | ||
# perform tests in browser using WPBrowser or WPWebDriver modules. | ||
class_name: AcceptanceTester | ||
modules: | ||
enabled: | ||
- \Helper\Acceptance | ||
- WPBrowser | ||
- WPDb | ||
config: | ||
WPBrowser: | ||
url: 'http://wordpress.dev' | ||
adminUsername: admin | ||
adminPassword: admin | ||
adminUrl: /wp-admin | ||
WPDb: | ||
dsn: 'mysql:host=localhost;dbname=test' | ||
user: root | ||
password: '' | ||
dump: tests/_data/dump.sql | ||
populate: true | ||
cleanup: true | ||
url: 'http://wordpress.dev' | ||
tablePrefix: wp_ |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
<?php | ||
namespace acceptance\frontend; | ||
|
||
class ShortcodeCest { | ||
|
||
/** | ||
* @test | ||
* it should render simple shortcode | ||
*/ | ||
public function it_should_render_simple_shortcode(\AcceptanceTester $I) { | ||
$content = 'Lorem ipsum [idlikethis]'; | ||
$I->havePostInDatabase(['post_name' => 'foo', 'post_content' => $content]); | ||
|
||
$I->amOnPage('/foo'); | ||
$text = "I'd like this"; | ||
$I->seeElement('.idlikethis-button[data-text="' . $text . '"] button'); | ||
} | ||
|
||
/** | ||
* @test | ||
* it should render extended shortcode | ||
*/ | ||
public function it_should_render_extended_shortcode(\AcceptanceTester $I) { | ||
$content = 'Lorem ipsum [idlikethis]Some idea of mine[/idlikethis]'; | ||
$I->havePostInDatabase(['post_name' => 'foo', 'post_content' => $content]); | ||
|
||
$I->amOnPage('/foo'); | ||
$text = "Some idea of mine"; | ||
$I->seeElement('.idlikethis-button[data-text="' . $text . '"] button'); | ||
} | ||
} |
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
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
Oops, something went wrong.