Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / tests / src / Unit / Plugin / DMU / Converter / Functions / DBTest.php
1 <?php
2
3 namespace Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Converter\Functions;
4
5 use Pharborist\Parser;
6
7 /**
8  * @group DMU.Converter.Functions
9  * @covers \Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions\DB
10  *
11  * Currently, the DB plugin behaves identically for every function it handles,
12  * so I'm only bothering to test db_select().
13  */
14 class DBTest extends FunctionCallModifierTestBase {
15
16   public function setUp() {
17     parent::setUp();
18     $this->plugin = $this->getPlugin([], [ 'function' => 'db_select' ]);
19   }
20
21   public function testRewriteDBSelectAllowedTable() {
22     $function_call = Parser::parseExpression('db_select("session")');
23     $this->assertSame($function_call, $this->plugin->rewrite($function_call, $this->target));
24   }
25
26   public function testRewriteDBSelectForbiddenTable() {
27     $function_call = Parser::parseExpression('db_select("variable")');
28     $this->assertNull($this->plugin->rewrite($function_call, $this->target));
29   }
30
31 }