TaxonomyViewsIntegratorTest.php in Taxonomy Views Integrator 8
File
tests/src/Functional/TaxonomyViewsIntegratorTest.php
View source
<?php
namespace Drupal\Tests\tvi\Functional;
class TaxonomyViewsIntegratorTest extends TaxonomyViewsIntegratorTestBase {
public function setUp() {
parent::setUp();
$permissions = [
'access content',
'administer site configuration',
'administer views',
'administer nodes',
'administer taxonomy',
'access administration pages',
'define view for vocabulary ' . $this->vocabulary1
->id(),
'define view for terms in ' . $this->vocabulary1
->id(),
'define view for vocabulary ' . $this->vocabulary2
->id(),
'define view for terms in ' . $this->vocabulary2
->id(),
];
$admin_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($admin_user);
}
public function testTaxonomyHasTaxonomyViewsIntegratorSettingForm() {
$this
->drupalGet('taxonomy/term/' . $this->term1
->id() . '/edit');
$this
->assertSession()
->responseContains('Taxonomy Views Integrator Settings');
$this
->assertSession()
->responseContains('The default view to use for this term page.');
}
public function testViewLoadsFromTermSettings() {
$this
->drupalGet('taxonomy/term/' . $this->term1
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
$this
->drupalGet('taxonomy/term/' . $this->term2
->id());
$this
->assertSession()
->responseContains('TVI Bar View');
$this
->drupalGet('taxonomy/term/' . $this->term3
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
$this
->drupalGet('taxonomy/term/' . $this->term4
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
$this
->drupalGet('taxonomy/term/' . $this->term5
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
$this
->drupalGet('taxonomy/term/' . $this->term6
->id());
$this
->assertSession()
->responseContains('TVI Bar View');
$this
->drupalGet('taxonomy/term/' . $this->term7
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
$this
->drupalGet('taxonomy/term/' . $this->term8
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
$this
->drupalGet('taxonomy/term/' . $this->term9
->id());
$this
->assertSession()
->responseNotContains('TVI Foo View');
$this
->assertSession()
->responseContains($this->term9
->label());
$this
->drupalGet('taxonomy/term/' . $this->term10
->id());
$this
->assertSession()
->responseContains('TVI Bar View');
$this
->drupalGet('taxonomy/term/' . $this->term11
->id());
$this
->assertSession()
->responseContains('TVI Bar View');
$this
->drupalGet('taxonomy/term/' . $this->term12
->id());
$this
->assertSession()
->responseContains('TVI Foo View');
}
}