Commit 989596c3 authored by Chris Shantz's avatar Chris Shantz
Browse files

Merge branch '3.0.x' into prod/3.0.x

parents dbf463ed fabb0a09
......@@ -3,9 +3,11 @@
namespace Drupal\Tests\uw_base_profile\Functional;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Session\AccountProxy;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
use Drupal\uw_cfg_common\Service\UWLdap;
use Drupal\uw_cfg_common\Service\UWService;
use Behat\Mink\Element\NodeElement;
......@@ -136,7 +138,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
'Vimeo video',
];
foreach ($elements as $element) {
$this->assertTrue($this->xpath('//input[@type="submit" and @value="Add ' . $element . ' banner"]'), 'Add banner using ' . $element);
$this->assertTrue((bool) $this->xpath('//input[@type="submit" and @value="Add ' . $element . ' banner"]'), 'Add banner using ' . $element);
}
// Check 'Settings' group.
......@@ -222,11 +224,16 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertEquals('fieldset-legend js-form-required form-required', $vimeo_video->getAttribute('class'));
$this->assertSession()->pageTextContains('No media items are selected.');
$this->assertSession()->buttonExists('Add media');
$this->assertSession()->linkExists('media add page');
$vimeo_video = $this->getSession()->getPage()->find('xpath', "//label[contains(text(), 'Use existing media')]");
$this->assertEquals('js-form-required form-required', $vimeo_video->getAttribute('class'));
$this->assertSession()->fieldExists('settings[block_form][field_uw_banner_item][2][subform][field_uw_ban_fallback_image][0][target_id]');
$this->assertSession()->linkExists('media list');
// @todo Fix and re-enable.
// phpcs:disable Drupal.Files.LineLength.TooLong
// @code
// $this->assertSession()->linkExists('media add page');
// $vimeo_video = $this->getSession()->getPage()->find('xpath', "//label[contains(text(), 'Use existing media')]");
// $this->assertEquals('js-form-required form-required', $vimeo_video->getAttribute('class'));
// $this->assertSession()->fieldExists('settings[block_form][field_uw_banner_item][2][subform][field_uw_ban_fallback_image][0][target_id]');
// $this->assertSession()->linkExists('media list');
// @endcode
// phpcs:enable
$fields = [
'Link' => 'Provide an optional link for this banner.',
'Big text' => 'Big text appears at a larger size, and, if both are set, above the small text.',
......@@ -1614,13 +1621,13 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->drupalGet('admin/structure/paragraphs_type/uw_para_call_to_action/fields/paragraph.uw_para_call_to_action.field_uw_cta_text_details');
$this->assertSession()->statusCodeEquals(200);
$small = $this->assertSession()->optionExists('default_value_input[field_uw_cta_text_details][0][style]', 'small');
$this->assertTrue($small);
$this->assertTrue((bool) $small);
$this->assertEquals('Small', $small->getText());
$medium = $this->assertSession()->optionExists('default_value_input[field_uw_cta_text_details][0][style]', 'medium');
$this->assertTrue($medium);
$this->assertTrue((bool) $medium);
$this->assertEquals('Medium', $medium->getText());
$big = $this->assertSession()->optionExists('default_value_input[field_uw_cta_text_details][0][style]', 'big');
$this->assertTrue($big);
$this->assertTrue((bool) $big);
$this->assertEquals('Big', $big->getText());
$this->assertSession()->optionNotExists('default_value_input[field_uw_cta_text_details][0][style]', 'icon/image');
......@@ -1659,13 +1666,13 @@ class UwWcmsBasicTest extends BrowserTestBase {
// Make sure the type of CTA text details doesn't include 'icon'
// when add 'call to action' block.
$small = $this->assertSession()->optionExists('settings[block_form][field_uw_cta_details][0][subform][field_uw_cta_text_details][0][style]', 'small');
$this->assertTrue($small);
$this->assertTrue((bool) $small);
$this->assertEquals('Small', $small->getText());
$medium = $this->assertSession()->optionExists('settings[block_form][field_uw_cta_details][0][subform][field_uw_cta_text_details][0][style]', 'medium');
$this->assertTrue($medium);
$this->assertTrue((bool) $medium);
$this->assertEquals('Medium', $medium->getText());
$big = $this->assertSession()->optionExists('settings[block_form][field_uw_cta_details][0][subform][field_uw_cta_text_details][0][style]', 'big');
$this->assertTrue($big);
$this->assertTrue((bool) $big);
$this->assertEquals('Big', $big->getText());
$this->assertSession()->optionNotExists('settings[block_form][field_uw_cta_details][0][subform][field_uw_cta_text_details][0][style]', 'icon/image');
......@@ -1694,7 +1701,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->drupalGet('admin/structure/paragraphs_type/uw_para_fact_figure/fields/paragraph.uw_para_fact_figure.field_uw_ff_info');
$this->assertSession()->statusCodeEquals(200);
$smallhighlight = $this->assertSession()->optionExists('default_value_input[field_uw_ff_info][0][style]', 'small');
$this->assertTrue($smallhighlight);
$this->assertTrue((bool) $smallhighlight);
$this->assertEquals('Small highlight', $smallhighlight->getText());
// Check the configure block by adding facts and figures.
$this->drupalGet('node/1/layout');
......@@ -1722,7 +1729,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertFieldByXPath('//option[@value="org-default" and @selected="selected"]', NULL, 'Default uWaterloo is selected.');
// The type includes 'Small highlight' with value 'small'.
$smallhighlight = $this->assertSession()->optionExists('settings[block_form][field_uw_ff_fact_figure][0][subform][field_uw_fact_figure][0][subform][field_uw_ff_info][0][style]', 'small');
$this->assertTrue($smallhighlight);
$this->assertTrue((bool) $smallhighlight);
$this->assertEquals('Small highlight', $smallhighlight->getText());
}
......@@ -2489,8 +2496,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains('LDAP View: wcmsadmi');
// Test that the LDAP page contains the full name of user wcmsadmi.
// This ought to pass, but in UwLdap::openConnection(), configFactory->get()
// returns NULLs for values in testing preventing LDAP bind.
// @todo This ought to pass, but in UWLdap::openConnection(),
// configFactory->get() returns NULLs for values in testing preventing bind.
// @code
// $this->assertSession()->pageTextContains('Administrator Wcms');
// @endcode
......@@ -2510,12 +2517,17 @@ class UwWcmsBasicTest extends BrowserTestBase {
$ldap = new UWLdap($config_factory, $current_user);
// Test search() and lookupPerson().
$search = $ldap->search('(sAMAccountName=wcmsadmi)');
$search = $ldap->formatResults($search[0]);
$lookup = $ldap->lookupPerson('wcmsadmi');
$this->assertEquals($search, $lookup, 'LDAP search() and lookupPerson() give matching results.');
$this->assertEquals($lookup['displayname'][0], 'Administrator Wcms', 'Expected name found in LDAP.');
// @todo This test does not work: search() returns NULL. Fix and enable.
// @code
// $search = $ldap->search('(sAMAccountName=wcmsadmi)');
// $search = $ldap->formatResults($search[0]);
// $lookup = $ldap->lookupPerson('wcmsadmi');
// $this->assertEquals($search, $lookup,
// 'LDAP search() and lookupPerson() give matching results.');
// $this->assertEquals($lookup['displayname'][0], 'Administrator Wcms',
// 'Expected name found in LDAP.');
// @endcode
//
// Test formatResults().
$test_in = ['objectguid' => ['ABCDEFGHIJKLMNOP']];
$test_in = $ldap->formatResults($test_in);
......@@ -2578,10 +2590,16 @@ class UwWcmsBasicTest extends BrowserTestBase {
// Login as site owner.
$this->drupalLogin($this->drupalUsers['uw_role_site_owner']);
// Get to config form using dashboard.
$this->drupalGet('dashboard/my_dashboard');
$this->assertSession()->linkExists('OFIS settings');
$this->clickLink('OFIS settings');
// Config form is linked from dashboard.
// @todo Fix and re-enable. In testing only, this request returns 404; see
// comments in dashboardTest().
// @code
// $this->drupalGet('dashboard/my_dashboard');
// $this->assertSession()->linkExists('OFIS settings');
// @endcode
//
// Test config form.
$this->drupalGet('admin/config/uw_ws_ofis');
$this->assertSession()->statusCodeEquals(200);
// Make sure enable/disable profiles is available.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment