From cd4e9617888d727b13dc5c6e9cf3fbb68dabe894 Mon Sep 17 00:00:00 2001 From: peter279k Date: Wed, 10 Mar 2021 10:42:57 +0800 Subject: [PATCH] Improve PHPUnit fixtures --- tests/Devices/CachedCollectionTest.php | 4 ++-- tests/Devices/CollectionTest.php | 4 ++-- tests/Devices/DiscoveryTest.php | 4 ++-- tests/Devices/FactoryTest.php | 2 +- tests/LiveTest.php | 2 +- tests/MockTest.php | 4 ++-- tests/NetworkTest.php | 4 ++-- tests/PlaylistLiveTest.php | 4 ++-- tests/QueueLiveTest.php | 4 ++-- tests/QueueTest.php | 4 ++-- tests/Services/RadioTest.php | 2 +- tests/SpeakerLiveTest.php | 2 +- tests/SpeakerTest.php | 4 ++-- tests/StateTest.php | 2 +- tests/Tracks/FactoryTest.php | 2 +- tests/Tracks/TrackTest.php | 4 ++-- tests/Utils/DirectoryTest.php | 4 ++-- 17 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/Devices/CachedCollectionTest.php b/tests/Devices/CachedCollectionTest.php index 9afce769..9dbef7c3 100644 --- a/tests/Devices/CachedCollectionTest.php +++ b/tests/Devices/CachedCollectionTest.php @@ -21,7 +21,7 @@ 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); @@ -29,7 +29,7 @@ public function setUp(): void } - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); } diff --git a/tests/Devices/CollectionTest.php b/tests/Devices/CollectionTest.php index 8abad659..4cbdeb0e 100644 --- a/tests/Devices/CollectionTest.php +++ b/tests/Devices/CollectionTest.php @@ -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(); } diff --git a/tests/Devices/DiscoveryTest.php b/tests/Devices/DiscoveryTest.php index 7ab4a130..57207f28 100644 --- a/tests/Devices/DiscoveryTest.php +++ b/tests/Devices/DiscoveryTest.php @@ -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()); @@ -31,7 +31,7 @@ public function setUp(): void } - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); } diff --git a/tests/Devices/FactoryTest.php b/tests/Devices/FactoryTest.php index 6b2dca22..30069f58 100644 --- a/tests/Devices/FactoryTest.php +++ b/tests/Devices/FactoryTest.php @@ -11,7 +11,7 @@ class FactoryTest extends TestCase { - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); } diff --git a/tests/LiveTest.php b/tests/LiveTest.php index 618db5d7..72d4c46d 100644 --- a/tests/LiveTest.php +++ b/tests/LiveTest.php @@ -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(); diff --git a/tests/MockTest.php b/tests/MockTest.php index 9d10511e..9f1c3886 100644 --- a/tests/MockTest.php +++ b/tests/MockTest.php @@ -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); diff --git a/tests/NetworkTest.php b/tests/NetworkTest.php index a981181b..28d84a2f 100644 --- a/tests/NetworkTest.php +++ b/tests/NetworkTest.php @@ -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(); } diff --git a/tests/PlaylistLiveTest.php b/tests/PlaylistLiveTest.php index d1cc20ac..0f06bac5 100644 --- a/tests/PlaylistLiveTest.php +++ b/tests/PlaylistLiveTest.php @@ -14,7 +14,7 @@ class PlaylistLiveTest extends LiveTest /** @var string */ protected $playlistName = "phpunit-test"; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -26,7 +26,7 @@ public function setUp(): void } - public function tearDown(): void + protected function tearDown(): void { $this->playlist->delete(); } diff --git a/tests/QueueLiveTest.php b/tests/QueueLiveTest.php index 1adc6d79..b47baef9 100644 --- a/tests/QueueLiveTest.php +++ b/tests/QueueLiveTest.php @@ -18,7 +18,7 @@ class QueueLiveTest extends LiveTest /** @var ControllerStateInterface */ protected $state; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -35,7 +35,7 @@ public function setUp(): void } - public function tearDown(): void + protected function tearDown(): void { if ($this->controller) { $this->controller->restoreState($this->state); diff --git a/tests/QueueTest.php b/tests/QueueTest.php index 2054d201..666a6edd 100644 --- a/tests/QueueTest.php +++ b/tests/QueueTest.php @@ -22,7 +22,7 @@ class QueueTest extends MockTest /** @var Queue */ protected $queue; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -31,7 +31,7 @@ public function setUp(): void $this->queue = new Queue($this->controller); } - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); } diff --git a/tests/Services/RadioTest.php b/tests/Services/RadioTest.php index 9171b481..a10e1d9a 100644 --- a/tests/Services/RadioTest.php +++ b/tests/Services/RadioTest.php @@ -19,7 +19,7 @@ class RadioTest extends MockTest private $radio; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/SpeakerLiveTest.php b/tests/SpeakerLiveTest.php index e45152e8..db794f07 100644 --- a/tests/SpeakerLiveTest.php +++ b/tests/SpeakerLiveTest.php @@ -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(); diff --git a/tests/SpeakerTest.php b/tests/SpeakerTest.php index 6c66d0c6..576be5f1 100644 --- a/tests/SpeakerTest.php +++ b/tests/SpeakerTest.php @@ -16,7 +16,7 @@ class SpeakerTest extends MockTest /** @var Speaker */ protected $speaker; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -24,7 +24,7 @@ public function setUp(): void $this->speaker = $this->getSpeaker($this->device); } - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); } diff --git a/tests/StateTest.php b/tests/StateTest.php index b837cdc3..a95ae5ce 100644 --- a/tests/StateTest.php +++ b/tests/StateTest.php @@ -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"); diff --git a/tests/Tracks/FactoryTest.php b/tests/Tracks/FactoryTest.php index 1d645554..5041840a 100644 --- a/tests/Tracks/FactoryTest.php +++ b/tests/Tracks/FactoryTest.php @@ -19,7 +19,7 @@ class FactoryTest extends MockTest /** @var Factory */ private $factory; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/Tracks/TrackTest.php b/tests/Tracks/TrackTest.php index 6b346ef1..8355050b 100644 --- a/tests/Tracks/TrackTest.php +++ b/tests/Tracks/TrackTest.php @@ -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"); @@ -53,7 +53,7 @@ public function setUp(): void } - public function tearDown(): void + protected function tearDown(): void { Mockery::close(); } diff --git a/tests/Utils/DirectoryTest.php b/tests/Utils/DirectoryTest.php index af01641d..3ab3d5f4 100644 --- a/tests/Utils/DirectoryTest.php +++ b/tests/Utils/DirectoryTest.php @@ -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(); }