Skip to content

Commit

Permalink
no event sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Oct 29, 2015
1 parent a5aa81e commit eebbddd
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 188 deletions.
122 changes: 61 additions & 61 deletions coverage/AbstractSession.php.html

Large diffs are not rendered by default.

178 changes: 94 additions & 84 deletions coverage/Config.php.html

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions coverage/MySQLSession.php.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions coverage/RedisSession.php.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion coverage/SessionException.php.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h4>Legend</h4>
<span class="warning"><strong>Dead Code</strong></span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Thu Oct 29 17:00:29 GMT 2015.</small>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Thu Oct 29 17:46:18 GMT 2015.</small>
</p>
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
Expand Down
10 changes: 5 additions & 5 deletions coverage/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h3>Project Risks</h3>
<footer>
<hr/>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Thu Oct 29 17:00:29 GMT 2015.</small>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Thu Oct 29 17:46:18 GMT 2015.</small>
</p>
</footer>
</div>
Expand All @@ -157,7 +157,7 @@ <h3>Project Risks</h3>
.yAxis.tickFormat(d3.format('d'));

d3.select('#classCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,5], "Class Coverage"))
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,6], "Class Coverage"))
.transition().duration(500).call(chart);

nv.utils.windowResize(chart.update);
Expand All @@ -175,7 +175,7 @@ <h3>Project Risks</h3>
.yAxis.tickFormat(d3.format('d'));

d3.select('#methodCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,33], "Method Coverage"))
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,35], "Method Coverage"))
.transition().duration(500).call(chart);

nv.utils.windowResize(chart.update);
Expand Down Expand Up @@ -225,7 +225,7 @@ <h3>Project Risks</h3>
chart.yAxis.axisLabel('Cyclomatic Complexity');

d3.select('#classComplexity svg')
.datum(getComplexityData([[100,33,"<a href=\"AbstractSession.php.html#18\">AbstractSession<\/a>"],[100,3,"<a href=\"Config.php.html#20\">Config<\/a>"],[100,13,"<a href=\"MySQLSession.php.html#14\">MySQLSession<\/a>"],[100,8,"<a href=\"RedisSession.php.html#13\">RedisSession<\/a>"],[100,0,"<a href=\"SessionException.php.html#9\">SessionException<\/a>"]], 'Class Complexity'))
.datum(getComplexityData([[100,33,"<a href=\"AbstractSession.php.html#18\">AbstractSession<\/a>"],[100,3,"<a href=\"Config.php.html#22\">Config<\/a>"],[100,2,"<a href=\"MySQLNoEventSession.php.html#10\">MySQLNoEventSession<\/a>"],[100,13,"<a href=\"MySQLSession.php.html#14\">MySQLSession<\/a>"],[100,8,"<a href=\"RedisSession.php.html#13\">RedisSession<\/a>"],[100,0,"<a href=\"SessionException.php.html#9\">SessionException<\/a>"]], 'Class Complexity'))
.transition()
.duration(500)
.call(chart);
Expand All @@ -249,7 +249,7 @@ <h3>Project Risks</h3>
chart.yAxis.axisLabel('Method Complexity');

d3.select('#methodComplexity svg')
.datum(getComplexityData([[100,1,"<a href=\"AbstractSession.php.html#35\">AbstractSession::__construct<\/a>"],[100,4,"<a href=\"AbstractSession.php.html#47\">AbstractSession::setID<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#74\">AbstractSession::idExists<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#82\">AbstractSession::destroySafely<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#97\">AbstractSession::isActive<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#106\">AbstractSession::start<\/a>"],[100,3,"<a href=\"AbstractSession.php.html#135\">AbstractSession::identityCheck<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#158\">AbstractSession::getFingerprint<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#168\">AbstractSession::handleIdentityCheckFailure<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#183\">AbstractSession::destroy<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#200\">AbstractSession::gc<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#216\">AbstractSession::open<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#228\">AbstractSession::close<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#238\">AbstractSession::sessionRequiredWarning<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#253\">AbstractSession::offsetExists<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#274\">AbstractSession::offsetGet<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#296\">AbstractSession::offsetSet<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#315\">AbstractSession::offsetUnset<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#334\">AbstractSession::__get<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#347\">AbstractSession::__set<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#355\">AbstractSession::__destruct<\/a>"],[100,1,"<a href=\"Config.php.html#77\">Config::__construct<\/a>"],[100,2,"<a href=\"Config.php.html#86\">Config::setDefaultConfig<\/a>"],[100,1,"<a href=\"MySQLSession.php.html#30\">MySQLSession::__construct<\/a>"],[100,2,"<a href=\"MySQLSession.php.html#47\">MySQLSession::destroy<\/a>"],[100,4,"<a href=\"MySQLSession.php.html#72\">MySQLSession::idExists<\/a>"],[100,4,"<a href=\"MySQLSession.php.html#106\">MySQLSession::read<\/a>"],[100,2,"<a href=\"MySQLSession.php.html#143\">MySQLSession::write<\/a>"],[100,3,"<a href=\"RedisSession.php.html#33\">RedisSession::__construct<\/a>"],[100,1,"<a href=\"RedisSession.php.html#59\">RedisSession::destroy<\/a>"],[100,1,"<a href=\"RedisSession.php.html#74\">RedisSession::idExists<\/a>"],[100,2,"<a href=\"RedisSession.php.html#88\">RedisSession::read<\/a>"],[100,1,"<a href=\"RedisSession.php.html#107\">RedisSession::write<\/a>"]], 'Method Complexity'))
.datum(getComplexityData([[100,1,"<a href=\"AbstractSession.php.html#35\">AbstractSession::__construct<\/a>"],[100,4,"<a href=\"AbstractSession.php.html#47\">AbstractSession::setID<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#74\">AbstractSession::idExists<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#82\">AbstractSession::destroySafely<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#97\">AbstractSession::isActive<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#106\">AbstractSession::start<\/a>"],[100,3,"<a href=\"AbstractSession.php.html#135\">AbstractSession::identityCheck<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#158\">AbstractSession::getFingerprint<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#168\">AbstractSession::handleIdentityCheckFailure<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#183\">AbstractSession::destroy<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#200\">AbstractSession::gc<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#216\">AbstractSession::open<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#228\">AbstractSession::close<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#238\">AbstractSession::sessionRequiredWarning<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#253\">AbstractSession::offsetExists<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#274\">AbstractSession::offsetGet<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#296\">AbstractSession::offsetSet<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#315\">AbstractSession::offsetUnset<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#334\">AbstractSession::__get<\/a>"],[100,1,"<a href=\"AbstractSession.php.html#347\">AbstractSession::__set<\/a>"],[100,2,"<a href=\"AbstractSession.php.html#355\">AbstractSession::__destruct<\/a>"],[100,1,"<a href=\"Config.php.html#86\">Config::__construct<\/a>"],[100,2,"<a href=\"Config.php.html#95\">Config::setDefaultConfig<\/a>"],[100,1,"<a href=\"MySQLNoEventSession.php.html#22\">MySQLNoEventSession::gc<\/a>"],[100,1,"<a href=\"MySQLNoEventSession.php.html#35\">MySQLNoEventSession::start<\/a>"],[100,1,"<a href=\"MySQLSession.php.html#30\">MySQLSession::__construct<\/a>"],[100,2,"<a href=\"MySQLSession.php.html#47\">MySQLSession::destroy<\/a>"],[100,4,"<a href=\"MySQLSession.php.html#72\">MySQLSession::idExists<\/a>"],[100,4,"<a href=\"MySQLSession.php.html#106\">MySQLSession::read<\/a>"],[100,2,"<a href=\"MySQLSession.php.html#143\">MySQLSession::write<\/a>"],[100,3,"<a href=\"RedisSession.php.html#33\">RedisSession::__construct<\/a>"],[100,1,"<a href=\"RedisSession.php.html#59\">RedisSession::destroy<\/a>"],[100,1,"<a href=\"RedisSession.php.html#74\">RedisSession::idExists<\/a>"],[100,2,"<a href=\"RedisSession.php.html#88\">RedisSession::read<\/a>"],[100,1,"<a href=\"RedisSession.php.html#107\">RedisSession::write<\/a>"]], 'Method Complexity'))
.transition()
.duration(500)
.call(chart);
Expand Down
38 changes: 33 additions & 5 deletions coverage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">101&nbsp;/&nbsp;101</div></td>
<td class="success small"><div align="right">110&nbsp;/&nbsp;110</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">29&nbsp;/&nbsp;29</div></td>
<td class="success small"><div align="right">31&nbsp;/&nbsp;31</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">5&nbsp;/&nbsp;5</div></td>
<td class="success small"><div align="right">6&nbsp;/&nbsp;6</div></td>
</tr>

<tr>
Expand Down Expand Up @@ -105,7 +105,35 @@
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">13&nbsp;/&nbsp;13</div></td>
<td class="success small"><div align="right">14&nbsp;/&nbsp;14</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
</tr>

<tr>
<td class="success"><span class="glyphicon glyphicon-file"></span> <a href="MySQLNoEventSession.php.html">MySQLNoEventSession.php</a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">8&nbsp;/&nbsp;8</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
Expand Down Expand Up @@ -220,7 +248,7 @@ <h4>Legend</h4>
<span class="success"><strong>High</strong>: 90% to 100%</span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Thu Oct 29 17:00:29 GMT 2015.</small>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Thu Oct 29 17:46:18 GMT 2015.</small>
</p>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/MySQLNoEventSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function gc($maxLifeTime) {
$table = $this->config->table;

return $this->client->prepare('DELETE FROM `' . $table . '` WHERE DATE_ADD(`access`, INTERVAL ' .
$maxLifeTime . ' SECOND) >= NOW()')->execute();
$maxLifeTime . ' SECOND) < NOW()')->execute();
}

/**
Expand Down
40 changes: 40 additions & 0 deletions tests/MySQLNoEventTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace AloFramework\Session\Tests;

use AloFramework\Session\MySQLNoEventSession as Sess;
use AloFramework\Session\Config as Cfg;
use PDO;

require_once 'MySQLTest.php';

class MySQLNoEventTest extends MySQLTest {

function testStart() {
$this->assertFalse(Sess::isActive());
(new Sess($this->client, $this->cfg))->start();

$this->assertEquals(1, ini_get('session.gc_probability'));
$this->assertEquals((int)$this->cfg->gc, ini_get('session.gc_divisor'));
$this->assertEquals((int)$this->cfg->timeout, ini_get('session.gc_maxlifetime'));
}

function testGc() {
$gc = 1;
$cfg = new Cfg([Cfg::CFG_SECURE => false,
Cfg::CFG_TIMEOUT => $gc,
Cfg::CFG_GC => $gc]);

$sess = (new Sess($this->client, $cfg))->start();
$id = session_id();
$_SESSION[__METHOD__] = 'foo';
session_write_close();

$this->assertNotEmpty($this->client->query('SELECT `data` FROM `' . $this->cfg->table . '` WHERE `id`=\'' .
$id . '\'')->fetchAll(PDO::FETCH_ASSOC));
sleep(2);
$sess->gc($gc);
$this->assertEmpty($this->client->query('SELECT `data` FROM `' . $this->cfg->table . '` WHERE `id`=\'' .
$id . '\'')->fetchAll(PDO::FETCH_ASSOC));
}
}
4 changes: 3 additions & 1 deletion tests/MySQLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
use AloFramework\Session\MySQLSession as Sess;
use PDO;

require_once 'AbstractSessionTest.php';

class MySQLTest extends AbstractSessionTest {

/** @var PDO */
private $client;
protected $client;

function __construct($name = null, array $data = [], $dataName = '') {
parent::__construct($name, $data, $dataName);
Expand Down
2 changes: 2 additions & 0 deletions tests/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use AloFramework\Session\RedisSession as Sess;

require_once 'AbstractSessionTest.php';

class RedisTest extends AbstractSessionTest {

/** @var \Redis */
Expand Down

0 comments on commit eebbddd

Please sign in to comment.