Пример #1
0
 public function testSettingSingleValidSites()
 {
     $sites = $this->config['sites'];
     // Remove the first site
     unset($sites[$this->site_1]);
     $site = new \App\Lib\Site($sites);
     $filtered = $site->prepare($this->single_site);
     // Confirm the single set has been set
     $this->assertEquals($filtered, $site->getSites());
     $this->assertEquals(count($site->getSites()), 1);
     $this->assertFalse($site->hasChoices());
     $this->assertFalse($site->ready());
     // Set to first site.
     $site->set($this->hash_2);
     $this->assertTrue($site->ready());
     $this->assertEquals($site->getName(), $this->site_2);
     $this->assertEquals($this->hash_2, $site->getHash());
     $this->assertEquals($filtered[$this->hash_2]['path'], $site->getConfig());
     $this->assertEquals(basename($filtered[$this->hash_2]['path']), $site->getConfigFile());
     $this->assertEquals(dirname($filtered[$this->hash_2]['path']) . '/', $site->getConfigPath());
     // Check there's only one site but we don't have choices
     $this->assertEquals(count($site->getSites()), 1);
     $this->assertFalse($site->hasChoices());
 }