Skip to content

Commit

Permalink
Updates unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Brückner <dev@froschdesignstudio.de>
  • Loading branch information
froschdesign committed Jul 10, 2020
1 parent 82995d6 commit 7ccc389
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 42 deletions.
4 changes: 2 additions & 2 deletions test/Adapter/ArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class ArrayTest extends TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->adapter = new Adapter\ArrayAdapter(range(1, 101));
}
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->adapter = null;
parent::tearDown();
Expand Down
8 changes: 4 additions & 4 deletions test/Adapter/CallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function testMustDefineTwoCallbacksOnConstructor()
};
$adapter = new Callback($itemsCallback, $countCallback);

$this->assertAttributeSame($itemsCallback, 'itemsCallback', $adapter);
$this->assertAttributeSame($countCallback, 'countCallback', $adapter);
$this->assertSame([], $adapter->getItems(1, 1));
$this->assertSame(0, $adapter->count());
}

public function testShouldAcceptAnyCallableOnConstructor()
Expand All @@ -38,8 +38,8 @@ public function testShouldAcceptAnyCallableOnConstructor()
$countCallback = 'rand';
$adapter = new Callback($itemsCallback, $countCallback);

$this->assertAttributeInternalType('callable', 'itemsCallback', $adapter);
$this->assertAttributeInternalType('callable', 'countCallback', $adapter);
$this->assertSame(range(1, 10), $adapter->getItems(1, 1));
$this->assertIsInt($adapter->count());
}

public function testMustRunItemCallbackToGetItems()
Expand Down
4 changes: 2 additions & 2 deletions test/Adapter/DbSelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DbSelectTest extends TestCase
/** @var DbSelect */
protected $dbSelect;

public function setUp()
public function setUp(): void
{
$this->mockResult = $this->createMock('Laminas\Db\Adapter\Driver\ResultInterface');
$this->mockStatement = $this->createMock('Laminas\Db\Adapter\Driver\StatementInterface');
Expand Down Expand Up @@ -106,7 +106,7 @@ public function testCustomCount()
*/
public function testReturnValueIsArray()
{
$this->assertInternalType('array', $this->dbSelect->getItems(0, 10));
$this->assertIsArray($this->dbSelect->getItems(0, 10));
}

public function testGetArrayCopyShouldContainSelectItems()
Expand Down
2 changes: 1 addition & 1 deletion test/Adapter/DbTableGatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DbTableGatewayTest extends TestCase
/** @var \Laminas\Db\TableGateway\TableGateway */
protected $mockTableGateway;

public function setup()
public function setup(): void
{
$mockStatement = $this->createMock('Laminas\Db\Adapter\Driver\StatementInterface');
$mockDriver = $this->createMock('Laminas\Db\Adapter\Driver\DriverInterface');
Expand Down
4 changes: 2 additions & 2 deletions test/Adapter/IteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class IteratorTest extends TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$iterator = new \ArrayIterator(range(1, 101));
Expand All @@ -35,7 +35,7 @@ protected function setUp()
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->adapter = null;
parent::tearDown();
Expand Down
4 changes: 2 additions & 2 deletions test/Adapter/NullFillTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class NullFillTest extends TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->adapter = new Adapter\NullFill(101);
}
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->adapter = null;
parent::tearDown();
Expand Down
8 changes: 0 additions & 8 deletions test/AdapterPluginManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ public function testFactoryReturnsPluginManager()

$adapters = $factory($container, AdapterPluginManager::class);
$this->assertInstanceOf(AdapterPluginManager::class, $adapters);

if (method_exists($adapters, 'configure')) {
// laminas-servicemanager v3
$this->assertAttributeSame($container, 'creationContext', $adapters);
} else {
// laminas-servicemanager v2
$this->assertSame($container, $adapters->getServiceLocator());
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/AdapterPluginManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AdapterPluginManagerTest extends TestCase

protected $mockAdapter;

protected function setUp()
protected function setUp(): void
{
$this->adapterPluginManager = new AdapterPluginManager(
$this->getMockBuilder(ContainerInterface::class)->getMock()
Expand Down
2 changes: 1 addition & 1 deletion test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FactoryTest extends TestCase

protected $mockAdapter;

protected function setUp()
protected function setUp(): void
{
$this->mockSelect = $this->createMock('Laminas\Db\Sql\Select');

Expand Down
6 changes: 3 additions & 3 deletions test/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PaginatorTest extends TestCase
*/
protected $adapter = null;

protected function setUp()
protected function setUp(): void
{
$this->select = new Sql\Select;
$this->select->from('test');
Expand All @@ -74,7 +74,7 @@ protected function setUp()
$this->_restorePaginatorDefaults();
}

protected function tearDown()
protected function tearDown(): void
{
$this->testCollection = null;
$this->paginator = null;
Expand Down Expand Up @@ -696,7 +696,7 @@ public function testToJson()

$expected = '"0":1,"1":2,"2":3,"3":4,"4":5,"5":6,"6":7,"7":8,"8":9,"9":10';

$this->assertContains($expected, $json);
$this->assertStringContainsString($expected, $json);
}

// Laminas-5519
Expand Down
4 changes: 2 additions & 2 deletions test/ScrollingStyle/AllTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AllTest extends TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->scrollingStyle = new \Laminas\Paginator\ScrollingStyle\All();
Expand All @@ -41,7 +41,7 @@ protected function setUp()
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->scrollingStyle = null;
$this->paginator = null;
Expand Down
4 changes: 2 additions & 2 deletions test/ScrollingStyle/ElasticTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ElasticTest extends TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->scrollingStyle = new \Laminas\Paginator\ScrollingStyle\Elastic();
Expand All @@ -41,7 +41,7 @@ protected function setUp()
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->scrollingStyle = null;
$this->paginator = null;
Expand Down
4 changes: 2 additions & 2 deletions test/ScrollingStyle/JumpingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class JumpingTest extends TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->scrollingStyle = new \Laminas\Paginator\ScrollingStyle\Jumping();
Expand All @@ -44,7 +44,7 @@ protected function setUp()
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->scrollingStyle = null;
$this->paginator = null;
Expand Down
4 changes: 2 additions & 2 deletions test/ScrollingStyle/SlidingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SlidingTest extends \PHPUnit\Framework\TestCase
/**
* Prepares the environment before running a test.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->_scrollingStyle = new \Laminas\Paginator\ScrollingStyle\Sliding();
Expand All @@ -43,7 +43,7 @@ protected function setUp()
/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
protected function tearDown(): void
{
$this->_scrollingStyle = null;
$this->paginator = null;
Expand Down
8 changes: 0 additions & 8 deletions test/ScrollingStylePluginManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ public function testFactoryReturnsPluginManager()

$scrollingStyles = $factory($container, ScrollingStylePluginManager::class);
$this->assertInstanceOf(ScrollingStylePluginManager::class, $scrollingStyles);

if (method_exists($scrollingStyles, 'configure')) {
// laminas-servicemanager v3
$this->assertAttributeSame($container, 'creationContext', $scrollingStyles);
} else {
// laminas-servicemanager v2
$this->assertSame($container, $scrollingStyles->getServiceLocator());
}
}

/**
Expand Down

0 comments on commit 7ccc389

Please sign in to comment.