SimplenewsTestSubscriptionOutput.php in Simplenews 8
File
src/Tests/SimplenewsTestSubscriptionOutput.php
View source
<?php
namespace Drupal\simplenews\Tests;
class SimplenewsTestSubscriptionOutput extends SimplenewsTestBase {
public function testSubscriptionVisiblity() {
entity_get_display('user', 'user', 'default')
->setComponent('simplenews', array(
'label' => 'hidden',
'type' => 'simplenews',
))
->save();
$admin_user = $this
->drupalCreateUser(array(
'administer users',
));
$user = $this
->drupalCreateUser(array(
'access user profiles',
'subscribe to newsletters',
'access content',
));
$this
->drupalLogin($admin_user);
$this
->drupalGet('user/' . $admin_user
->id());
$this
->assertLink('Manage subscriptions');
$this
->drupalLogout();
$this
->drupalLogin($user);
$this
->drupalGet('user/' . $admin_user
->id());
$this
->assertNoLink('Manage subscriptions');
$this
->drupalGet('user/' . $user
->id());
$this
->assertLink('Manage subscriptions');
$this
->drupalLogout();
$this
->drupalGet('user/' . $admin_user
->id());
$this
->assertNoLink('Manage subscriptions');
$this
->drupalGet('user/' . $user
->id());
$this
->assertNoLink('Manage subscriptions');
}
}