diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php new file mode 100644 index 0000000..f0a1ad4 --- /dev/null +++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php @@ -0,0 +1,63 @@ + 'Tracker Node Access Tests', + 'description' => 'Tests for private node access on /tracker.', + 'group' => 'Tracker', + ); + } + + public function setUp() { + $modules = array('node','comment','entity','text','field_sql_storage','tracker','node_access_test'); + parent::setUp($modules); + node_access_rebuild(); + variable_set('node_access_test_private', TRUE); + } + + function testTrackerNodeAccess() { + // Create user with node test view permission + $access_user = $this->drupalCreateUser(array('node test view')); + + // Create user without node test view permission + $no_access_user = $this->drupalCreateuser(); + + $this->drupalLogin($access_user); + + // Create some nodesi + $private_node = $this->drupalCreateNode(array( + 'title' => t('Private node test'), + 'private'=> TRUE, + )); + $public_node = $this->drupalCreateNode(array( + 'title' => t('Public node test'), + 'private'=>FALSE, + )); + + // User with access should see both nodes created + $this->drupalGet('tracker'); + $this->assertText($private_node->title, t('Private node is visible to user with private access.')); + $this->assertText($public_node->title, t('Public node is visible to user with private access.')); + + // User without access should not see private node + $this->drupalLogin($no_access_user); + $this->drupalGet('tracker'); + $this->assertNoText($private_node->title, t('Private node is not visible to user without private access.')); + $this->assertText($public_node->title, t('Public node is visible to user without private access.')); + } +} +?>