assertEquals( "SELECT * FROM Table WHERE ID = $1", $connector->replacePlaceholders("SELECT * FROM Table WHERE ID = ?") ); // Multiple variables $this->assertEquals( "SELECT * FROM Table WHERE ID = $1 AND Name = $2", $connector->replacePlaceholders("SELECT * FROM Table WHERE ID = ? AND Name = ?") ); // Ignoring question mark placeholders within string literals $this->assertEquals( "SELECT * FROM Table WHERE ID = $1 AND Name = $2 AND Content = '
What is love?
'", $connector->replacePlaceholders( "SELECT * FROM Table WHERE ID = ? AND Name = ? AND Content = 'What is love?
'" ) ); // Ignoring question mark placeholders within string literals with escaped slashes $this->assertEquals( "SELECT * FROM Table WHERE ID = $1 AND Title = '\\'' AND Content = 'What is love?
' AND Name = $2", $connector->replacePlaceholders( "SELECT * FROM Table WHERE ID = ? AND Title = '\\'' AND Content = 'What is love?
' AND Name = ?" ) ); // same as above, but use double single quote escape syntax $this->assertEquals( "SELECT * FROM Table WHERE ID = $1 AND Title = '''' AND Content = 'What is love?
' AND Name = $2", $connector->replacePlaceholders( "SELECT * FROM Table WHERE ID = ? AND Title = '''' AND Content = 'What is love?
' AND Name = ?" ) ); } }