-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor browser test, test monolog bridge (#641)
* Refactor browser test, test monolog bridge * Rename * Add Doctrine
- Loading branch information
Showing
12 changed files
with
157 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "*" | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
php-tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
env: | ||
COMPOSER_NO_INTERACTION: 1 | ||
|
||
strategy: | ||
matrix: | ||
php: [8.3, 7.4] | ||
|
||
name: PHP${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
extensions: pdo_sqlite | ||
|
||
- name: Install dependencies | ||
run: | | ||
composer update --prefer-dist --no-progress | ||
composer update --prefer-dist --no-progress --working-dir=demo/bridge/monolog | ||
composer update --prefer-dist --no-progress --working-dir=demo/bridge/doctrine | ||
composer run --working-dir=demo/bridge/doctrine install-schema | ||
- name: Execute Unit Tests | ||
run: vendor/bin/phpunit --testsuite=Browser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
composer.lock | ||
/vendor | ||
/demo/bridge/*/vendor | ||
/demo/bridge/doctrine/db.sqlite | ||
/src/DebugBar/Resources/vendor | ||
.phpunit.result.cache | ||
/drivers | ||
.phpunit.cache/ | ||
.phpunit.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
{ | ||
"require": { | ||
"doctrine/orm": "2.*", | ||
"doctrine/cache": "1.11.*", | ||
"symfony/yaml": "2.*" | ||
}, | ||
"autoload": { | ||
"psr-0": {"": "src/"} | ||
}, | ||
"scripts": { | ||
"install-schema": "@php vendor/bin/doctrine orm:schema-tool:update --force" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace DebugBar\Tests\Browser\Bridge; | ||
|
||
use DebugBar\Browser\Bridge\WebDriverElement; | ||
use DebugBar\Tests\Browser\AbstractBrowserTest; | ||
|
||
class DoctrineTest extends AbstractBrowserTest | ||
{ | ||
public function testMonologCollector(): void | ||
{ | ||
if (!file_exists(__DIR__ . '/../../../../../demo/bridge/doctrine/vendor/autoload.php')) { | ||
$this->markTestSkipped('Doctrine is not installed'); | ||
} | ||
|
||
$client = static::createPantherClient(); | ||
|
||
$client->request('GET', '/demo/bridge/doctrine'); | ||
|
||
// Wait for Debugbar to load | ||
$crawler = $client->waitFor('.phpdebugbar-body'); | ||
usleep(1000); | ||
|
||
if (!$this->isTabActive($crawler, 'database')) { | ||
$client->click($this->getTabLink($crawler, 'database')); | ||
} | ||
|
||
$crawler = $client->waitForVisibility('.phpdebugbar-panel[data-collector=database]'); | ||
|
||
$statements = $crawler->filter('.phpdebugbar-panel[data-collector=database] .phpdebugbar-widgets-sql') | ||
->each(function($node){ | ||
return $node->getText(); | ||
}); | ||
|
||
$this->assertEquals('INSERT INTO products (name) VALUES (?)', $statements[1]); | ||
$this->assertCount(3, $statements); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace DebugBar\Tests\Browser\Bridge; | ||
|
||
use DebugBar\Browser\Bridge\WebDriverElement; | ||
use DebugBar\Tests\Browser\AbstractBrowserTest; | ||
|
||
class MonologTest extends AbstractBrowserTest | ||
{ | ||
public function testMonologCollector(): void | ||
{ | ||
if (!file_exists(__DIR__ . '/../../../../../demo/bridge/monolog/vendor/autoload.php')) { | ||
$this->markTestSkipped('Monolog is not installed'); | ||
} | ||
|
||
$client = static::createPantherClient(); | ||
|
||
$client->request('GET', '/demo/bridge/monolog'); | ||
|
||
// Wait for Debugbar to load | ||
$crawler = $client->waitFor('.phpdebugbar-body'); | ||
usleep(1000); | ||
|
||
if (!$this->isTabActive($crawler, 'monolog')) { | ||
$client->click($this->getTabLink($crawler, 'monolog')); | ||
} | ||
|
||
$crawler = $client->waitForVisibility('.phpdebugbar-panel[data-collector=monolog]'); | ||
|
||
$messages = $crawler->filter('.phpdebugbar-panel[data-collector=monolog] .phpdebugbar-widgets-value') | ||
->each(function($node){ | ||
return $node->getText(); | ||
}); | ||
|
||
$this->assertStringContainsString('demo.INFO: hello world [] []', $messages[0]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters