Skip to content

Commit

Permalink
Merge branch 'hotfix/0.13.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
garex committed Jun 15, 2015
2 parents 324dddd + d0a271b commit 2df391a
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
## Changelog ##


### 0.13.1 ###

Fix result permalinks with front prefixes

* Make permalinks like /archives/%post_id% work for both tests and results


### 0.13 ###

Respondent passings for user and admin with improved usability
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Tags:** psychological, testing, test, quiz
**Requires at least:** 3.2
**Tested up to:** 4.2.2
**Stable tag:** 0.13
**Stable tag:** 0.13.1
**License:** GPLv3
**License URI:** http://www.gnu.org/licenses/gpl-3.0.html

Expand Down
7 changes: 6 additions & 1 deletion src/Doer/WordPressEntitiesRegistrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ public function __construct(WpTesting_WordPressFacade $wp)

$this->wp->getWP()->add_query_var('wpt_passing_slug');
$rewrite = $this->wp->getRewrite();
$prefix = implode('/', array_filter(array(
trim($rewrite->root, '/'),
trim($rewrite->front, '/'),
$testSlug,
)));
$rewrite->add_rule(
$rewrite->root . $testSlug . '/([^/]+)/([a-z0-9]+[a-f0-9]{32})/?$',
$prefix . '/([^/]+)/([a-z0-9]+[a-f0-9]{32})/?$',
$rewrite->index . '?wpt_test=$matches[1]&wpt_passing_slug=$matches[2]',
'top'
);
Expand Down
2 changes: 1 addition & 1 deletion tests/mocha/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export TZ="UTC"
rm -f /tmp/cookies.*.txt

# Run tests
mocha-casperjs --grep=Plugin_deactivation --invert --timeout=360000
mocha-casperjs --grep=deactivation --invert --timeout=360000
2 changes: 1 addition & 1 deletion tests/mocha/test/0-plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Plugin_activation', function() {
describe('Plugin activation', function() {

before(function () {
require('../login-as').admin(this)
Expand Down
2 changes: 1 addition & 1 deletion tests/mocha/test/scale-aggregates.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Scale_Aggregates', function() {
describe('Scale aggregates', function() {

before(function () {
require('../login-as').admin(this)
Expand Down
52 changes: 43 additions & 9 deletions tests/mocha/test/y-passing.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
function wptDescribePassings(isPermalinks) {
var isUnderUser = isPermalinks
describe('Passings' + (isPermalinks ? ' with permalinks' : '')
+ (isUnderUser ? ' under user' : ''), function() {
function wptSetupPermalinks(structure) {
var structureLabel = (structure == '') ? 'default' : structure

before(function () {
require('../login-as').admin(this, true)
})

it('should setup permalinks', function() {
it('should setup permalinks to ' + structureLabel, function() {
casper.thenOpen('http://wpti.dev/wp-admin/options-permalink.php')

casper.waitForUrl(/options/).then(function() {
'Permalink Settings'.should.be.textInDOM
if (isPermalinks) {
if (structure !== '') {
this.click('#permalink_structure')
this.sendKeys('#permalink_structure', '/%postname%/');
this.sendKeys('#permalink_structure', structure);
} else {
this.clickLabel(' Default', 'label')
}
Expand All @@ -30,6 +28,14 @@ describe('Passings' + (isPermalinks ? ' with permalinks' : '')

require('../login-as').adminLogout()
})
}

function wptDescribePassings(isPermalinks) {
var isUnderUser = isPermalinks
describe((isPermalinks ? 'With' : 'Without') + ' permalinks '
+ (isUnderUser ? 'under user' : 'as anonymous'), function() {

wptSetupPermalinks(isPermalinks ? '/%postname%/' : '')

if (isUnderUser) {
it('should login under user', function() {
Expand Down Expand Up @@ -293,5 +299,33 @@ describe('Passings' + (isPermalinks ? ' with permalinks' : '')
})
}

wptDescribePassings(false);
wptDescribePassings(true);
describe('Passings', function() {
describe('With numerical permalinks', function() {
wptSetupPermalinks('/archives/%post_id%')

it('should pass test', function() {
casper.open('http://wpti.dev/')

casper.then(function() {
this.clickLabel('Are You Hot or Not?!')
})

casper.waitForUrl(/test/, function() {
this.clickLabel('Yes', '*[@id="wpt-test-form"]/*[1]/*//label')
this.fill('form#wpt-test-form', {}, true)
})
})

it('should show result page', function() {
casper.waitForUrl(/test.+[a-z0-9]+[a-f0-9]{32}/, function() {
'Fatal'.should.not.be.textInDOM
'Results'.should.be.textInDOM
'Allow others to rate the vacuum on the Earth'.should.not.be.textInDOM
this.getTitle().should.not.match(/^Page not found/)
})
})
})

wptDescribePassings(false)
wptDescribePassings(true)
})
4 changes: 2 additions & 2 deletions tests/mocha/test/y-respondents-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Filtering', function() {
})

casper.waitForUrl(/filter_condition[^=]+test_id[^=]+=\d+/, function() {
'2 items'.should.be.textInDOM
'3 items'.should.be.textInDOM
expect('#the-list').to.contain.text('Are You Hot or Not?!')
expect('#the-list').to.not.contain.text('Test Containing Results')
})
Expand All @@ -73,7 +73,7 @@ describe('Filtering', function() {
})

casper.waitForUrl(/filter_condition[^=]+user[^=]+=[^&]/, function() {
'1 item'.should.be.textInDOM
'2 items'.should.be.textInDOM
expect('#the-list').to.not.contain.text('user')
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/mocha/test/z-plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Plugin_deactivation', function() {
describe('Plugin deactivation', function() {

before(function () {
require('../login-as').admin(this)
Expand Down
2 changes: 1 addition & 1 deletion wp-testing.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Wp-testing
* Plugin URI: http://wordpress.org/extend/plugins/wp-testing/
* Description: Helps to create psychological tests.
* Version: 0.13
* Version: 0.13.1
* Author: Alexander Ustimenko
* Author URI: http://ustimen.co
* License: GPL3
Expand Down

0 comments on commit 2df391a

Please sign in to comment.