Skip to content

Commit

Permalink
increasing php test coverage, small group test formatting fix and add…
Browse files Browse the repository at this point in the history
…ing a match regex in the inspector so that multi-line arrays do not count as executable
  • Loading branch information
daschl committed Jul 8, 2011
1 parent 2a6ccf7 commit b408096
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion analysis/Inspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ function($str) { return preg_quote($str, '/'); },
$pattern = join('|', array(
"({$pattern})",
"\\$(.+)\($",
"\s*['\"]\w+['\"]\s*=>\s*.+[\{\(]$"
"\s*['\"]\w+['\"]\s*=>\s*.+[\{\(]$",
"\s*['\"]\w+['\"]\s*=>\s*['\"]*.+['\"]*\s*"
));
$options['pattern'] = "/^({$pattern})/";
}
Expand Down
12 changes: 12 additions & 0 deletions tests/cases/storage/session/adapter/PhpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ public function testDelete() {
$this->assertTrue($result);
}

/**
* Checks if erasing the whole session array works as expected.
*/
public function testClear() {
$_SESSION['foo'] = 'bar';
$this->assertFalse(empty($_SESSION));
$closure = $this->Php->clear();
$this->assertTrue(is_callable($closure));
$result = $closure($this->Php, array(), null);
$this->assertTrue(empty($_SESSION));
}

public function testCheckThrowException() {
$Php = new MockPhp(array('init' => false));
$this->expectException('/Could not start session./');
Expand Down
2 changes: 0 additions & 2 deletions tests/cases/test/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ public function testAddEmptyTestsRun() {

$results = $group->tests();
$this->assertTrue(is_a($results, 'lithium\util\Collection'));

$results = $group->tests();
$this->assertTrue(is_a($results->current(), 'lithium\tests\mocks\test\MockUnitTest'));

$results = $group->tests()->run();
Expand Down

0 comments on commit b408096

Please sign in to comment.