assertSame( [ 'mysqli', 'curl', 'mbstring', ], Util::listPHPExtensions() ); } /** * Test for private getConditionValue */ public function testGetConditionValue(): void { $this->assertSame( ['IS NULL', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ null,// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) []),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['IS NULL', 'CONCAT(`table`.`orgname`)'], $this->callFunction( null, Util::class, 'getConditionValue', [ null,// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) []),// field meta 0,// fields count '',// condition key 'CONCAT(`table`.`orgname`)',// condition ] ) ); $this->assertSame( ['= 123456', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 123456,// row new FieldMetadata(MYSQLI_TYPE_SHORT, MYSQLI_NUM_FLAG, (object) []),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= 123.456', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 123.456,// row // This was MYSQLI_TYPE_FLOAT but failed the condition // Probably that the test case was wrong new FieldMetadata(MYSQLI_TYPE_LONG, MYSQLI_NUM_FLAG, (object) []),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= \'value\'', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 'value',// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) []),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= CAST(0x76616c7565 AS BINARY)', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 'value',// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['charsetnr' => 63]),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= \'value\'', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 'value',// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) [ 'numeric' => false, 'type' => 'blob', 'charsetnr' => 32,// armscii8_general_ci ]),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= \'value\'', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 'value',// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) [ 'numeric' => false, 'type' => 'blob', 'charsetnr' => 48,// latin1_general_ci ]),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= CAST(0x76616c7565 AS BINARY)', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 'value',// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) [ 'numeric' => false, 'type' => 'blob', 'charsetnr' => 63,// binary ]),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['= CAST(0x76616c7565 AS BINARY)', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 'value',// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['charsetnr' => 63]),// field meta 1,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( [' = 1001', ' CHAR_LENGTH(conditionKey) '], $this->callFunction( null, Util::class, 'getConditionValue', [ str_repeat('*', 1001),// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['charsetnr' => 63]),// field meta 1,// fields count 'conditionKey',// condition key 'conditionInit',// condition ] ) ); $this->assertSame( [null, 'conditionInit'], $this->callFunction( null, Util::class, 'getConditionValue', [ str_repeat('*', 1001),// row new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) ['charsetnr' => 63]),// field meta 0,// fields count 'conditionKey',// condition key 'conditionInit',// condition ] ) ); $this->assertSame( ['= b\'0001\'', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ 0x1,// row new FieldMetadata(MYSQLI_TYPE_BIT, 0, (object) ['length' => 4]),// field meta 0,// fields count 'conditionKey',// condition key '',// condition ] ) ); $this->assertSame( ['', '=0x626c6f6f6f626262 AND'], $this->callFunction( null, Util::class, 'getConditionValue', [ 'blooobbb',// row new FieldMetadata(MYSQLI_TYPE_GEOMETRY, 0, (object) []),// field meta 0,// fields count '',// condition key '',// condition ] ) ); $this->assertSame( ['', '`table`.`tbl2`=0x626c6f6f6f626262 AND'], $this->callFunction( null, Util::class, 'getConditionValue', [ 'blooobbb',// row new FieldMetadata(MYSQLI_TYPE_GEOMETRY, 0, (object) []),// field meta 0,// fields count '',// condition key '`table`.`tbl2`',// condition ] ) ); $this->assertSame( ['', ''], $this->callFunction( null, Util::class, 'getConditionValue', [ str_repeat('*', 5001),// row new FieldMetadata(MYSQLI_TYPE_GEOMETRY, 0, (object) []),// field meta 0,// fields count '',// condition key '',// condition ] ) ); } /** * Test for Page Selector */ public function testPageSelector(): void { $this->assertStringContainsString( '