View getPrivateProperty.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function getProtectedProperty($class, $propertyName) | |
{ | |
$reflectObj = new \ReflectionObject($class); | |
$extensions = $reflectObj->getProperty($propertyName); | |
$extensions->setAccessible(true); | |
return $extensions->getValue($class); | |
} |
View setPrivateProperty.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function setProtectedProperty($class, $propertyName, $setValue) | |
{ | |
$reflectObj = new \ReflectionObject($class); | |
$extensions = $reflectObj->getProperty($propertyName); | |
$extensions->setAccessible(true); | |
$extensions->setValue($class, $setValue); | |
} |
View runProtectedMethod.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function runProtectedFunction($class, $methodName, $args = null) | |
{ | |
$reflectMethod = new \ReflectionMethod($class,$methodName); | |
$reflectMethod->setAccessible(true); | |
if ($args == null) | |
{ | |
return $reflectMethod->invoke($class); | |
} else | |
{ | |
return $reflectMethod->invokeArgs($class, $args); |
View RandomInt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Random generator in range | |
* | |
* @param minimum Number | |
* @param maximum Number | |
* @return randomNumber | |
*/ | |
public int randomGenerator(int minimum, int maximum) { | |
Random rn = new Random(); | |
int range = maximum - minimum + 1; |
View IgnorePhpUnitTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->markTestSkipped('This test is scipped '); |
View ProxySelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.io.IOException; | |
/** | |
* this class is needed for Java to connect to SOCKS proxy server | |
* Unfortunately Java cannot resolve remote DNS and therefore, when we set System.properties | |
* with our proxy server details, we hit incorrect server . This is because | |
* Java is connecting to Proxy, but DNS is resolving with system details and therefore goes to server directly. |
View DbConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Base.db_connection; | |
import org.json.JSONObject; | |
import java.sql.*; | |
import static Base.TestPropertiesLoader.getDbConnectionDetails; | |
public class DbConnection { | |
public Connection con = null; |
View yaml_to_json_convertor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
import json | |
yml = "file_path" | |
data = yaml.load(open(yml,'r')) | |
json = json.dumps(data) | |
print(json) |
View getJSONFromFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static JSONObject getJSONFromFile(String path) throws JSONException, IOException, ParseException { | |
JSONParser parser = new JSONParser(); | |
Object obj = parser.parse(new FileReader(path)); | |
return new JSONObject(obj.toString()); | |
} |
View webDriverSnippets.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void refreshPage(){ | |
driver.navigate().refresh(); | |
} |
OlderNewer