ORMRow must not ignore failures on insert by deault.
[lhc/web/wiklou.git] / tests / phpunit / includes / site / SiteObjectTest.php
index cb5e07e..207f46c 100644 (file)
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @since 1.20
+ * @since 1.21
  *
  * @ingroup Site
  * @ingroup Test
  *
  * @group Site
+ * @group Database
  *
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw < jeroendedauw@gmail.com >
@@ -33,7 +34,7 @@ class SiteObjectTest extends ORMRowTest {
 
        /**
         * @see ORMRowTest::getRowClass
-        * @since 1.20
+        * @since 1.21
         * @return string
         */
        protected function getRowClass() {
@@ -42,7 +43,7 @@ class SiteObjectTest extends ORMRowTest {
 
        /**
         * @see ORMRowTest::getTableInstance
-        * @since 1.20
+        * @since 1.21
         * @return IORMTable
         */
        protected function getTableInstance() {
@@ -51,15 +52,15 @@ class SiteObjectTest extends ORMRowTest {
 
        /**
         * @see ORMRowTest::constructorTestProvider
-        * @since 1.20
+        * @since 1.21
         * @return array
         */
        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();
 
@@ -229,6 +230,17 @@ class SiteObjectTest extends ORMRowTest {
                $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