Skip to content

Commit

Permalink
Merge pull request #64 from LionsAd/fix-kernel-test-base
Browse files Browse the repository at this point in the history
Issue #50: Support KernelTestBase tests natively.
  • Loading branch information
LionsAd committed Dec 13, 2015
2 parents 41a44e7 + b207cd6 commit bf2e489
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
3 changes: 3 additions & 0 deletions environments/drupal-8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export PATH="$DRUPAL_TI_DIST_DIR/usr/bin:$PATH"
# Display used for running selenium browser.
export DISPLAY=:99.0

# export SIMPLETEST_DB for KernelTestBase, so it is available for all runners.
export SIMPLETEST_DB="$DRUPAL_TI_DB_URL"

# Use 'minimal' by default for Drupal 8.
if [ -z "$DRUPAL_TI_INSTALL_PROFILE" ]
then
Expand Down
2 changes: 1 addition & 1 deletion tests/drupal-8/drupal_ti_test/tests/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<phpunit colors="true" bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite name="DrupalTiTest">
<directory>./src/</directory>
<directory>./src/Unit/</directory>
</testsuite>
</testsuites>
<!-- Filter for coverage reports. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* @file
* Contains \Drupal\Tests\drupal_ti_test\Kernel\DrupalTiTestTest;
*/

namespace Drupal\Tests\drupal_ti_test\Kernel;

use Drupal\drupal_ti_test\DrupalTiTest;
use Drupal\KernelTests\KernelTestBase;

/**
* @coversDefaultClass \Drupal\drupal_ti_test\DrupalTiTest
*
* @group drupal_ti_test
*/
class DrupalTiTestTest extends KernelTestBase {

/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['system', 'user', 'drupal_ti_test'];

/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();

// Do something with the database.
$this->installSchema('system', 'router');
}

/**
* @covers ::bar
*/
public function testKernelTestBase() {
$test = new DrupalTiTest();
$this->assertEquals('foo', $test->bar());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

/**
* @file
* Contains \Drupal\Tests\drupal_ti_test\DrupalTiTestTest;
* Contains \Drupal\Tests\drupal_ti_test\Unit\DrupalTiTestTest;
*/

namespace Drupal\Tests\drupal_ti_test;
namespace Drupal\Tests\drupal_ti_test\Unit;

use Drupal\drupal_ti_test\DrupalTiTest;

/**
* @coversDefaultClass \Drupal\drupal_ti_test\DrupalTiTest
*
* @group drupal_ti_test
*/
class DrupalTiTestTest extends \PHPUnit_Framework_TestCase {

Expand Down

0 comments on commit bf2e489

Please sign in to comment.