Skip to content

Commit

Permalink
Fixing Analytics Entity
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Oct 21, 2015
1 parent f1e6638 commit a4f2303
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Entities/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Analytics implements AnalyticsInterface
/**
* Make an Analytics instance.
*
* @param array $config
* @param array $configs
*/
public function __construct(array $config)
public function __construct(array $configs = [])
{
$this->setConfigs($config);
$this->setConfigs($configs);

$this->setGoogle($this->getConfig('google', ''));
}
Expand Down Expand Up @@ -99,6 +99,10 @@ public function __toString()
*/
private function renderGoogleScript()
{
if (empty($this->google)) {
return '';
}

return <<<EOT
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
Expand Down
8 changes: 8 additions & 0 deletions tests/Entities/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public function it_can_be_instantiated()
}
}

/** @test */
public function it_must_render_empty_on_init()
{
$this->analytics = new Analytics;

$this->assertEmpty($this->analytics->render());
}

/** @test */
public function it_can_render()
{
Expand Down

0 comments on commit a4f2303

Please sign in to comment.