Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PHPUnit fixtures #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/Devices/CachedCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class CachedCollectionTest extends TestCase
private $cache;
private $cachedCollection;

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


public function tearDown()
protected function tearDown()
{
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 @@ -13,14 +13,14 @@ class CollectionTest extends TestCase
private $factory;
private $collection;

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


public function tearDown()
protected function tearDown()
{
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 @@ -17,7 +17,7 @@ class DiscoveryTest extends TestCase
private $collection;
private $discovery;

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


public function tearDown()
protected function tearDown()
{
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()
protected function tearDown()
{
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 @@ -12,7 +12,7 @@ abstract class LiveTest extends TestCase
/** @var NetworkInterface */
protected $network;

public function setUp()
protected function setUp()
{
$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 @@ -15,12 +15,12 @@ abstract class MockTest extends TestCase
{
protected $network;

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

public function setUp()
protected function setUp()
{
$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()
protected function setUp()
{
$this->collection = Mockery::mock(CollectionInterface::class);
$this->network = new Network($this->collection);
}


public function tearDown()
protected function tearDown()
{
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 @@ -10,7 +10,7 @@ class PlaylistLiveTest extends LiveTest
protected $playlist;
protected $playlistName = "phpunit-test";

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

Expand All @@ -22,7 +22,7 @@ public function setUp()
}


public function tearDown()
protected function tearDown()
{
if ($this->playlist) {
$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 @@ -10,7 +10,7 @@ class QueueLiveTest extends LiveTest
protected $queue;
protected $state;

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

Expand All @@ -27,7 +27,7 @@ public function setUp()
}


public function tearDown()
protected function tearDown()
{
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 @@ -14,7 +14,7 @@ class QueueTest extends MockTest
protected $controller;
protected $queue;

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

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

public function tearDown()
protected function tearDown()
{
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()
protected function setUp()
{
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 @@ -6,7 +6,7 @@ class SpeakerLiveTest extends LiveTest
{
protected $speaker;

public function setUp()
protected function setUp()
{
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 @@ -11,15 +11,15 @@ class SpeakerTest extends MockTest
protected $device;
protected $speaker;

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

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

public function tearDown()
protected function tearDown()
{
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()
protected function setUp()
{
$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 @@ -18,7 +18,7 @@ class FactoryTest extends MockTest
/** @var Factory */
private $factory;

public function setUp()
protected function setUp()
{
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 @@ -34,7 +34,7 @@ class TrackTest extends TestCase
protected $track1;
protected $track2;

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


public function tearDown()
protected function tearDown()
{
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()
protected function setUp()
{
$this->filesystem = Mockery::mock(FilesystemInterface::class);
}


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