/**
  * Verify the get_val-method
  * @covers MslsLanguageArray::__construct
  * @covers MslsLanguageArray::get_val
  */
 function test_get_val_method()
 {
     $arr = array('fr_FR' => 0, 'it' => 1, 'de_DE' => 2, 'x' => 3);
     $obj = new MslsLanguageArray($arr);
     $this->assertEquals(1, $obj->get_val('it'));
     $this->assertEquals(0, $obj->get_val('fr_FR'));
     return $obj;
 }
 /**
  * Save
  * @param int $object_id
  * @param string $class
  * @codeCoverageIgnore
  */
 protected function save($object_id, $class)
 {
     if (has_action('msls_main_save')) {
         /**
          * Calls completely customized save-routine
          * @since 0.9.9
          * @param int $object_id
          * @param string Classname
          */
         do_action('msls_main_save', $object_id, $class);
     } else {
         $blogs = MslsBlogCollection::instance();
         $language = $blogs->get_current_blog()->get_language();
         $msla = new MslsLanguageArray($this->get_input_array($object_id));
         $options = new $class($object_id);
         $temp = $options->get_arr();
         if (0 != $msla->get_val($language)) {
             $options->save($msla->get_arr($language));
         } else {
             $options->delete();
         }
         foreach ($blogs->get() as $blog) {
             switch_to_blog($blog->userblog_id);
             $language = $blog->get_language();
             $larr_id = $msla->get_val($language);
             if (0 != $larr_id) {
                 $options = new $class($larr_id);
                 $options->save($msla->get_arr($language));
             } elseif (isset($temp[$language])) {
                 $options = new $class($temp[$language]);
                 $options->delete();
             }
             restore_current_blog();
         }
     }
 }