Пример #1
0
 /**
  * put
  *
  * @param Site $site site object
  *
  * @return Site
  */
 public function put(Site $site)
 {
     $this->repository->update($site);
     return $site;
 }
 /**
  * testUpdate
  *
  * @return void
  */
 public function testUpdate()
 {
     $repo = new SiteRepository($this->conn);
     $query = $this->query;
     $query->shouldReceive('update')->andReturn(1);
     $query->shouldReceive('where')->andReturn($query);
     $query->shouldReceive('first')->andReturn(['host' => 'test.com', 'siteKey' => 'test']);
     /**
      * @var Site $site
      */
     $site = $repo->find('test.com');
     $site->host = 'test2.com';
     $updatedSite = $repo->update($site);
     $this->assertEquals('test2.com', $updatedSite->host);
     $this->assertEquals('test', $updatedSite->siteKey);
 }