/** * add * * @param array $inputs input array * * @return Site */ public function add(array $inputs) { $host = $inputs['host']; $siteKey = $inputs['siteKey']; $this->checkUsableDomain($host); $site = new Site(['host' => $host, 'siteKey' => $siteKey]); $this->repository->insert($site); return $site; }
/** * testInsert * * @return void */ public function testInsert() { $repo = new SiteRepository($this->conn); $query = $this->query; $site = new Site(['host' => 'test.com', 'siteKey' => 'test']); $query->shouldReceive('insert')->andReturn(true); $result = $repo->insert($site); $this->assertEquals('test.com', $result->host); $this->assertEquals('test', $result->siteKey); }