Skip to content

Commit

Permalink
Improve PHPUnit fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
peter279k authored and duncan3dc committed Dec 18, 2024
1 parent 7705102 commit cd4e961
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions tests/Devices/CachedCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class CachedCollectionTest extends TestCase
/** @var CachedCollection */
private $cachedCollection;

public function setUp(): void
protected function setUp(): void
{
$this->collection = Mockery::mock(CollectionInterface::class);
$this->cache = Mockery::mock(CacheInterface::class);
$this->cachedCollection = new CachedCollection($this->collection, $this->cache);
}


public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Devices/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class CollectionTest extends TestCase
/** @var Collection */
private $collection;

public function setUp(): void
protected function setUp(): void
{
$this->factory = Mockery::mock(FactoryInterface::class);
$this->collection = new Collection($this->factory);
}


public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Devices/DiscoveryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DiscoveryTest extends TestCase
/** @var Intruder */
private $discovery;

public function setUp(): void
protected function setUp(): void
{
$this->collection = Mockery::mock(CollectionInterface::class);
$this->collection->shouldReceive("getLogger")->with()->andReturn(new NullLogger());
Expand All @@ -31,7 +31,7 @@ public function setUp(): void
}


public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Devices/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class FactoryTest extends TestCase
{
public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/LiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class LiveTest extends TestCase
/** @var NetworkInterface */
protected $network;

public function setUp(): void
protected function setUp(): void
{
$this->network = new Network();

Expand Down
4 changes: 2 additions & 2 deletions tests/MockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ abstract class MockTest extends TestCase
/** @var NetworkInterface&MockInterface */
protected $network;

public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}

public function setUp(): void
protected function setUp(): void
{
$this->network = Mockery::mock(NetworkInterface::class);

Expand Down
4 changes: 2 additions & 2 deletions tests/NetworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class NetworkTest extends MockTest
private $collection;


public function setUp(): void
protected function setUp(): void
{
$this->collection = Mockery::mock(CollectionInterface::class);
$this->network = new Network($this->collection);
}


public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/PlaylistLiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PlaylistLiveTest extends LiveTest
/** @var string */
protected $playlistName = "phpunit-test";

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand All @@ -26,7 +26,7 @@ public function setUp(): void
}


public function tearDown(): void
protected function tearDown(): void
{
$this->playlist->delete();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/QueueLiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class QueueLiveTest extends LiveTest
/** @var ControllerStateInterface */
protected $state;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand All @@ -35,7 +35,7 @@ public function setUp(): void
}


public function tearDown(): void
protected function tearDown(): void
{
if ($this->controller) {
$this->controller->restoreState($this->state);
Expand Down
4 changes: 2 additions & 2 deletions tests/QueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class QueueTest extends MockTest
/** @var Queue */
protected $queue;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand All @@ -31,7 +31,7 @@ public function setUp(): void
$this->queue = new Queue($this->controller);
}

public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Services/RadioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RadioTest extends MockTest
private $radio;


public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/SpeakerLiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SpeakerLiveTest extends LiveTest
/** @var SpeakerInterface */
protected $speaker;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$speakers = $this->network->getSpeakers();
Expand Down
4 changes: 2 additions & 2 deletions tests/SpeakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class SpeakerTest extends MockTest
/** @var Speaker */
protected $speaker;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

$this->device = $this->getDevice();
$this->speaker = $this->getSpeaker($this->device);
}

public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/StateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class StateTest extends TrackTest
{
public function setUp(): void
protected function setUp(): void
{
$controller = Mockery::mock(ControllerInterface::class);
$controller->shouldReceive("getIp")->andReturn("192.168.0.66");
Expand Down
2 changes: 1 addition & 1 deletion tests/Tracks/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FactoryTest extends MockTest
/** @var Factory */
private $factory;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
4 changes: 2 additions & 2 deletions tests/Tracks/TrackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TrackTest extends TestCase
/** @var TrackInterface */
protected $track2;

public function setUp(): void
protected function setUp(): void
{
$controller = Mockery::mock(ControllerInterface::class);
$controller->shouldReceive("getIp")->with()->andReturn("192.168.0.66");
Expand All @@ -53,7 +53,7 @@ public function setUp(): void
}


public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Utils/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class DirectoryTest extends TestCase
private $filesystem;


public function setUp(): void
protected function setUp(): void
{
$this->filesystem = Mockery::mock(FilesystemInterface::class);
}


public function tearDown(): void
protected function tearDown(): void
{
Mockery::close();
}
Expand Down

0 comments on commit cd4e961

Please sign in to comment.