switch ( $type ) {
case 'array':
$value = (array)$value;
+ // fall-through!
case 'blob':
$value = serialize( $value );
+ // fall-through!
}
$values[$this->table->getPrefixedField( $name )] = $value;
$this->table->getName(),
$this->getWriteValues(),
is_null( $functionName ) ? __METHOD__ : $functionName,
- is_null( $options ) ? array( 'IGNORE' ) : $options
+ $options
);
// DatabaseBase::insert does not always return true for success as documented...
/**
* @dataProvider constructorTestProvider
+ * @depends testSave()
*/
public function testRemove( array $data, $loadDefaults ) {
$item = $this->getRowInstance( $data, $loadDefaults );
- $this->assertTrue( $item->save() );
-
$this->assertTrue( $item->remove() );
$this->assertFalse( $item->hasIdField() );
* @ingroup Test
*
* @group Site
+ * @group Database
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
public function constructorTestProvider() {
$argLists = array();
- $argLists[] = array( 'global_key' => '42' );
+ $argLists[] = array( 'global_key' => 'foo' );
- $argLists[] = array( 'global_key' => '42', 'type' => Site::TYPE_MEDIAWIKI );
+ $argLists[] = array( 'global_key' => 'bar', 'type' => Site::TYPE_MEDIAWIKI );
$constructorArgs = array();
$this->assertEquals( $path, $site->getPath( 'foo' ) );
}
+ public function testProtocolRelativePath() {
+ /* @var SiteObject $site */
+ $site = $this->getRowInstance( $this->getMockFields(), false );
+
+ $type = $site->getLinkPathType();
+ $path = '//acme.com/'; // protocol-relative URL
+ $site->setPath( $type, $path );
+
+ $this->assertEquals( '', $site->getProtocol() );
+ }
+
public function provideGetPageUrl() {
//NOTE: the assumption that the URL is built by replacing $1
// with the urlencoded version of $page