Skip to content

Commit a622758

Browse files
committed
✅ added output test
1 parent 6e87308 commit a622758

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/PluginTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Doctrine\ORM\Tools\SchemaTool;
77
use Doctrine\ORM\Tools\Setup;
88
use Symfony\Component\Console\Input\ArrayInput;
9+
use Symfony\Component\Console\Output\BufferedOutput;
910
use Symfony\Component\Console\Output\NullOutput;
1011
use Tapestry\Console\DefaultInputDefinition;
1112
use Tapestry\Entities\Configuration;
@@ -69,17 +70,20 @@ public static function runTapestry($siteDir = __DIR__ . DIRECTORY_SEPARATOR . 'm
6970
'--env' => 'testing'
7071
], $definitions));
7172

72-
$tapestry->setOutput(new NullOutput());
73+
74+
$bufferedOutput = new BufferedOutput();
75+
76+
$tapestry->setOutput($bufferedOutput);
7377

7478
/** @var array $steps */
7579
$steps = $tapestry->getContainer()->get('Compile.Steps');
7680
$generator = new Generator($steps, $tapestry);
7781

7882
/** @var Project $project */
7983
$project = $tapestry->getContainer()->get(Project::class);
80-
$generator->generate($project, new NullOutput());
84+
$generator->generate($project, $bufferedOutput);
8185

82-
return $tapestry;
86+
return $bufferedOutput;
8387
}
8488

8589
/**
@@ -89,7 +93,9 @@ public function testNoChangeRunThrough()
8993
{
9094
$loops = 0;
9195
while ($loops < 2) {
92-
self::runTapestry();
96+
$output = self::runTapestry();
97+
$this->assertContains('[$] Syncing with database.', $output->fetch());
98+
9399
$contentTypes = self::$em->getRepository(ContentType::class)->findAll();
94100
$this->assertCount(2, $contentTypes);
95101

0 commit comments

Comments
 (0)