Skip to content

Commit

Permalink
Fixed in issue where a query would crash - #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey McCormick committed Dec 20, 2016
1 parent 34d645b commit 0b2263f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/QueryCacheBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ public function __construct(QueryCache $cache, ConnectionInterface $connection,
parent::__construct($connection, $grammar, $processor);
}

/**
* Generates a new query.
*
* @return static
*/
public function newQuery()
{
return new static($this->cache, $this->connection, $this->grammar, $this->processor);
}

/**
* Returns the query results.
*
Expand Down
6 changes: 6 additions & 0 deletions tests/QueryCacheBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@ public function dont_remember_disables_caching()

$this->builder->dontRemember();
}

/** @test */
public function new_query_returns_a_new_static()
{
$this->isInstanceOf(QueryCacheBuilder::class, $this->builder->newQuery());
}
}

0 comments on commit 0b2263f

Please sign in to comment.