Skip to content

Commit 7e3bf94

Browse files
author
Kendrick
committed
unit testing
1 parent bdcfa05 commit 7e3bf94

File tree

7 files changed

+75067
-3
lines changed

7 files changed

+75067
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
composer.phar
3-
vendor/
3+
vendor/
4+
phpunit.phar

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
- FRAMEWORK_BUNDLE="~2.3" TWIG_BUNDLE_VERSION="~2.0" TWIG_VERSION="~1.12"
1313

1414
before_script:
15+
- composer self-update
1516
- composer require symfony/framework-bundle:${FRAMEWORK_BUNDLE}
1617
- composer require symfony/twig-bundle:${TWIG_BUNDLE_VERSION}
1718
- composer require twig/twig:${TWIG_VERSION}

DataCollector/GitDataCollector.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
use Symfony\Component\HttpFoundation\Response;
88
use Symfony\Component\Filesystem\Filesystem;
99

10-
10+
/**
11+
* Class GitDataCollector
12+
* @package Kendrick\SymfonyDebugToolbarGit\DataCollector
13+
*/
1114
class GitDataCollector extends DataCollector
1215
{
1316

@@ -33,8 +36,17 @@ public function collect(Request $request, Response $response, \Exception $except
3336

3437
$fs = new Filesystem();
3538

39+
// is there a web directory ?
40+
41+
if ($fs->exists('../web')) {
42+
$gitPath = '../.git';
43+
} else {
44+
// unit tests
45+
$gitPath = '.git';
46+
}
47+
3648
// if there is no .git directory
37-
if (!$fs->exists('../.git')) {
49+
if (!$fs->exists($gitPath)) {
3850
$this->data['gitData'] = false;
3951
return;
4052
}

0 commit comments

Comments
 (0)