[TASK] Disable a series of functional tests with mssql
[Packages/TYPO3.CMS.git] / typo3 / sysext / typo3db_legacy / Tests / Functional / Database / PreparedStatementTest.php
1 <?php
2 namespace TYPO3\CMS\Typo3DbLegacy\Tests\Functional\Database;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Typo3DbLegacy\Database\DatabaseConnection;
18
19 /**
20 * Test case for \TYPO3\CMS\Core\Database\PreparedStatement
21 */
22 class PreparedStatementTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
23 {
24 /**
25 * @var array
26 */
27 protected $coreExtensionsToLoad = ['typo3db_legacy'];
28
29 /**
30 * @var DatabaseConnection
31 */
32 protected $subject = null;
33
34 /**
35 * @var string
36 */
37 protected $testTable = 'test_database_connection';
38
39 /**
40 * @var string
41 */
42 protected $testField = 'test_field';
43
44 /**
45 * @var string
46 */
47 protected $anotherTestField = 'another_test_field';
48
49 /**
50 * Set the test up
51 */
52 protected function setUp()
53 {
54 parent::setUp();
55 $this->subject = $GLOBALS['TYPO3_DB'];
56 $this->subject->sql_query(
57 "CREATE TABLE {$this->testTable} (" .
58 ' id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,' .
59 " {$this->testField} MEDIUMBLOB," .
60 " {$this->anotherTestField} MEDIUMBLOB," .
61 ' PRIMARY KEY (id)' .
62 ') ENGINE=MyISAM DEFAULT CHARSET=utf8;'
63 );
64 }
65
66 /**
67 * Tear the test down
68 */
69 protected function tearDown()
70 {
71 $this->subject->sql_query("DROP TABLE {$this->testTable};");
72 unset($this->subject);
73 }
74
75 /**
76 * @test
77 *
78 * @group not-postgres
79 * @group not-mssql
80 */
81 public function prepareSelectQueryCreateValidQuery()
82 {
83 $this->assertTrue(
84 $this->subject->admin_query("INSERT INTO {$this->testTable} ({$this->testField}) VALUES ('aTestValue')")
85 );
86 $preparedQuery = $this->subject->prepare_SELECTquery(
87 "{$this->testField},{$this->anotherTestField}",
88 $this->testTable,
89 'id=:id',
90 '',
91 '',
92 '',
93 [':id' => 1]
94 );
95 $preparedQuery->execute();
96 $result = $preparedQuery->fetch();
97 $expectedResult = [
98 $this->testField => 'aTestValue',
99 $this->anotherTestField => null,
100 ];
101 $this->assertSame($expectedResult, $result);
102 }
103 }