Skip to content

Commit

Permalink
Inline test variables
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Nov 11, 2023
1 parent e65d191 commit 603bc9b
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions packages/framework/tests/Unit/ServeCommandOptionsUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,46 @@ class ServeCommandOptionsUnitTest extends TestCase
{
public function test_getHostSelection()
{
$command = new ServeCommandMock();
$this->assertSame('localhost', $command->getHostSelection());
$this->assertSame('localhost', (new ServeCommandMock())->getHostSelection());
}

public function test_getHostSelection_withHostOption()
{
$command = new ServeCommandMock(['host' => 'foo']);
$this->assertSame('foo', $command->getHostSelection());
$this->assertSame('foo', (new ServeCommandMock(['host' => 'foo']))->getHostSelection());
}

public function test_getHostSelection_withConfigOption()
{
$this->app['config']->set('hyde.server.host', 'foo');
$command = new ServeCommandMock();
$this->assertSame('foo', $command->getHostSelection());
$this->assertSame('foo', (new ServeCommandMock())->getHostSelection());
}

public function test_getHostSelection_withHostOptionAndConfigOption()
{
$this->app['config']->set('hyde.server.host', 'foo');
$command = new ServeCommandMock(['host' => 'bar']);
$this->assertSame('bar', $command->getHostSelection());
$this->assertSame('bar', (new ServeCommandMock(['host' => 'bar']))->getHostSelection());
}

public function test_getPortSelection()
{
$command = new ServeCommandMock();
$this->assertSame(8080, $command->getPortSelection());
$this->assertSame(8080, (new ServeCommandMock())->getPortSelection());
}

public function test_getPortSelection_withPortOption()
{
$command = new ServeCommandMock(['port' => 8081]);
$this->assertSame(8081, $command->getPortSelection());
$this->assertSame(8081, (new ServeCommandMock(['port' => 8081]))->getPortSelection());
}

public function test_getPortSelection_withConfigOption()
{
$this->app['config']->set('hyde.server.port', 8082);
$command = new ServeCommandMock();
$this->assertSame(8082, $command->getPortSelection());
$this->assertSame(8082, (new ServeCommandMock())->getPortSelection());
}

public function test_getPortSelection_withPortOptionAndConfigOption()
{
$this->app['config']->set('hyde.server.port', 8082);
$command = new ServeCommandMock(['port' => 8081]);
$this->assertSame(8081, $command->getPortSelection());
$this->assertSame(8081, (new ServeCommandMock(['port' => 8081]))->getPortSelection());
}
}

Expand Down

0 comments on commit 603bc9b

Please sign in to comment.