Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnConn committed Nov 11, 2020
1 parent 415fa0e commit cff0847
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/FunctionalJavascript/LiltSettingsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Drupal\Tests\tmgmt_lilt\FunctionalJavascript;

use Drupal\Core\Url;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;

/**
* TMGMT Lilt settings admin tests.
*
* @group tmgmt_lilt
*/
class LiltSettingsTest extends WebDriverTestBase {

/**
* {@inheritdoc}
*/
protected static $modules = [
'tmgmt',
'tmgmt_file',
'tmgmt_lilt',
];

/**
* {@inheritdoc}
*/
protected $defaultTheme = 'seven';

/**
* Ensure the Lilt settings form exists and contains the Lilt API base.
*/
public function testSettingsForm() {
$admin_user = $this->drupalCreateUser([], 'tmgmt_lilt_tester', TRUE);
$session = $this->getSession();
$this->drupalLogin($admin_user);
$this->drupalGet(Url::fromRoute('entity.tmgmt_translator.edit_form', [
'tmgmt_translator' => 'lilt',
]));

$page = $session->getPage();
$summary = $page->find('css', '#edit-settings-lilt-service-url');
$this->assertEquals('https://lilt.com/2', $summary->getAttribute('value'));
}

}
13 changes: 13 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
TMGMT Lilt Tests
---------------------
The companion [Lilt Drupal Environment](https://github.com/lilt/lilt_drupal_env)
repo contains a pre-configured Drupal environment in which to run tests on this
module.

Tests can be ran individually with the commands below:

- Code Standards: `ddev composer run-script code-standards`
- Deprecation Check: `ddev composer run-script deprecation-check`
- Functional JS: `ddev composer run-script functional-js`
- Lint: `ddev composer run-script lint`
- Unit Test: `ddev composer run-script unit-test`
2 changes: 2 additions & 0 deletions tests/src/Unit/LiltTranslatorUiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Tests Lilt translator UI class.
*
* @coversDefaultClass \Drupal\tmgmt_lilt\LiltTranslatorUi
*
* @group tmgmt_lilt
*/
class LiltTranslatorUiTest extends UnitTestCase {

Expand Down

0 comments on commit cff0847

Please sign in to comment.