X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fphp%2Fsrc%2FTests%2FPhpFilterTest.php;fp=web%2Fmodules%2Fcontrib%2Fphp%2Fsrc%2FTests%2FPhpFilterTest.php;h=20001fc084d97e6136c89b99fd66df4c2b250828;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/php/src/Tests/PhpFilterTest.php b/web/modules/contrib/php/src/Tests/PhpFilterTest.php new file mode 100644 index 000000000..20001fc08 --- /dev/null +++ b/web/modules/contrib/php/src/Tests/PhpFilterTest.php @@ -0,0 +1,44 @@ +getPermissionName(); + $web_user = $this->drupalCreateUser(['access content', 'create page content', 'edit own page content', $php_code_permission]); + $this->drupalLogin($web_user); + + // Create a node with PHP code in it. + $node = $this->createNodeWithCode(); + + // Make sure that the PHP code shows up as text. + $this->drupalGet('node/' . $node->id()); + $this->assertText('php print'); + + // Change filter to PHP filter and see that PHP code is evaluated. + $edit = []; + $edit['body[0][format]'] = $this->phpCodeFormat->id(); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->assertRaw(t('Basic page %title has been updated.', ['%title' => $node->label()]), 'PHP code filter turned on.'); + + // Make sure that the PHP code shows up as text. + $this->assertNoText('print "SimpleTest PHP was executed!"', "PHP code isn't displayed."); + $this->assertText('SimpleTest PHP was executed!', 'PHP code has been evaluated.'); + } + +}