/**
  * Create a server.
  *
  * @return Omeka_record $server The server.
  */
 public function __server($name = 'Test Server', $url = 'http://test/wms', $namespace = 'workspace', $username = '******', $password = '******', $active = 1)
 {
     $server = new NeatlineMapsServer();
     $server->name = $name;
     $server->url = $url;
     $server->namespace = $namespace;
     $server->username = $username;
     $server->password = $password;
     $server->active = $active;
     $server->save();
     return $server;
 }
 /**
  * When there is an existing active server and a new server is saved
  * with active = 1, toggle off old active server.
  *
  * @return void.
  */
 public function testSaveActiveServerWithExistingActiveServer()
 {
     // Create active server.
     $server1 = new NeatlineMapsServer();
     $server1->active = 1;
     $server1->save();
     // Create new active server.
     $server2 = new NeatlineMapsServer();
     $server2->active = 1;
     $server2->save();
     // Re-get and check for active.
     $server1 = $this->serversTable->find($server1->id);
     $server2 = $this->serversTable->find($server2->id);
     $this->assertEquals($server1->active, 0);
     $this->assertEquals($server2->active, 1);
 }