Skip to content

Commit

Permalink
Correcting some comments and some PHPUnit annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilverloop committed Feb 19, 2021
1 parent 67b5570 commit 7d20334
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 72 deletions.
12 changes: 4 additions & 8 deletions tests/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
namespace CyrilVerloop\Datatables;

use CyrilVerloop\Datatables\Column;
use CyrilVerloop\Datatables\Search;
use PHPUnit\Framework\TestCase;

/**
* Test a column for Datatables.
* Tests a column for Datatables.
* @package \Bundles\CrudBundle\Tests\Datatables
*
* @coversDefaultClass \CyrilVerloop\Datatables\Column
Expand Down Expand Up @@ -39,10 +38,9 @@ public function setUp(): void


/**
* Test that data can be accessed.
* Tests that data can be accessed.
* @return void
*
* @test
* @covers ::getData
*/
public function testCanGetData(): void
Expand All @@ -52,10 +50,9 @@ public function testCanGetData(): void


/**
* Test if the column can be searched.
* Tests if the column can be searched.
* @return void
*
* @test
* @covers ::isSearchable
*/
public function testCanGetSearchable(): void
Expand All @@ -65,10 +62,9 @@ public function testCanGetSearchable(): void


/**
* Test if the column can be ordered.
* Tests if the column can be ordered.
* @return void
*
* @test
* @covers ::isOrderable
*/
public function testCanGetOrderable(): void
Expand Down
29 changes: 10 additions & 19 deletions tests/ColumnsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPUnit\Framework\TestCase;

/**
* Test the list of columns for Datatables.
* Tests the list of columns for Datatables.
* @package \Bundles\CrudBundle\Tests\Datatables
*
* @coversDefaultClass \CyrilVerloop\Datatables\Columns
Expand Down Expand Up @@ -60,12 +60,11 @@ public function getMissingColumnDatas(): array
}

/**
* Test that an exception is thrown
* Tests that an exception is thrown
* if datas are missing.
* @param mixed[] $missingColumnDatas missing search datas.
* @return void
*
* @test
* @covers ::addFromArray
* @dataProvider getMissingColumnDatas
*/
Expand Down Expand Up @@ -98,12 +97,11 @@ public function getInvalidColumnDatas(): array
}

/**
* Test that an exception is thrown
* Tests that an exception is thrown
* if datas are invalid.
* @param mixed[] $invalidColumnDatas invalid datas.
* @return void
*
* @test
* @covers ::addFromArray
* @dataProvider getInvalidColumnDatas
*/
Expand Down Expand Up @@ -133,12 +131,11 @@ public function getUnexpectedColumnDatas(): array
}

/**
* Test that an exception is thrown
* Tests that an exception is thrown
* if datas are unexpected.
* @param mixed[] $unexpectedColumnDatas unexpected datas.
* @return void
*
* @test
* @covers ::addFromArray
* @dataProvider getUnexpectedColumnDatas
*/
Expand All @@ -152,11 +149,10 @@ public function testCanThrowAnUnexpectedValueExceptionWhenConstructing(array $un


/**
* Test that a column can be added from an array
* Tests that a column can be added from an array
* when "searchable" and "oderable" are "false".
* @return void
*
* @test
* @covers ::addFromArray
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand Down Expand Up @@ -186,11 +182,10 @@ public function testCanABeConstructedWhenSearchableAndOrderableAreFalse(): void
}

/**
* Test that a column can be added from an array
* Tests that a column can be added from an array
* when "searchable" and "oderable" are "true".
* @return void
*
* @test
* @covers ::addFromArray
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand All @@ -216,10 +211,9 @@ public function testCanBeConstructedWhenSearchableAndOrderableAreTrue(): void
}

/**
* Test that an object can be constructed with datas.
* Tests that an object can be constructed with datas.
* @return void
*
* @test
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
* @uses \CyrilVerloop\Datatables\Search
Expand Down Expand Up @@ -247,11 +241,10 @@ public function testCanBeConstructedWithDatas(): void


/**
* Test that an InvalidArgumentException is thrown
* Tests that an InvalidArgumentException is thrown
* if the position does not exist.
* @return void
*
* @test
* @covers ::getColumn
* @depends testCanABeConstructedWhenSearchableAndOrderableAreFalse
* @depends testCanBeConstructedWhenSearchableAndOrderableAreTrue
Expand All @@ -267,10 +260,9 @@ public function testCanThrowOutOfBoundsExceptionIfPositionDoesNotExist(): void


/**
* Test that a column can be added and found in the list.
* Tests that a column can be added and found in the list.
* @return void
*
* @test
* @covers ::add
* @covers ::getColumn
* @uses \CyrilVerloop\Datatables\Column
Expand All @@ -290,10 +282,9 @@ public function testCanAddAndGetColumn(): void


/**
* Test that the iterator can be rewinded.
* Tests that the iterator can be rewinded.
* @return void
*
* @test
* @covers ::rewind
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand Down
9 changes: 4 additions & 5 deletions tests/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\TestCase;

/**
* Test an order for Datatables.
* Tests an order for Datatables.
* @package \Bundles\CrudBundle\Tests\Datatables
*
* @coversDefaultClass \CyrilVerloop\Datatables\Order
Expand Down Expand Up @@ -37,7 +37,7 @@ public function setUp(): void


/**
* Test that an object can not be constructed
* Tests that an object can not be constructed
* if the column number is negative.
* @return void
*/
Expand All @@ -50,7 +50,7 @@ public function testCanNotBeConstructedWhenColumnIsNegative(): void
}

/**
* Test that an object can not be constructed
* Tests that an object can not be constructed
* if the direction is invalid.
* @return void
*/
Expand All @@ -75,12 +75,11 @@ public function getValidColumnAndDir(): array
}

/**
* Test that an object can be constructed.
* Tests that an object can be constructed.
* @param int $column the column number.
* @param string $dir the direction (asc/desc).
* @return void
*
* @test
* @covers ::getColumn
* @covers ::getDir
* @dataProvider getValidColumnAndDir
Expand Down
22 changes: 7 additions & 15 deletions tests/OrdersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
use PHPUnit\Framework\TestCase;

/**
* Test the list of orders for Datatables.
* Tests the list of orders for Datatables.
* @package \Bundles\CrudBundle\Tests\Datatables
*
* @coversDefaultClass \CyrilVerloop\Datatables\Orders
* @covers ::__construct
*/
class OrdersTest extends TestCase
{
Expand Down Expand Up @@ -50,13 +51,11 @@ public function getMissingOrderDatas(): array
}

/**
* Test that an exception is thrown
* Tests that an exception is thrown
* if datas are missing.
* @param mixed[] $missingOrderDatas missing search datas.
* @return void
*
* @test
* @covers ::__construct
* @covers ::addFromArray
* @dataProvider getMissingOrderDatas
*/
Expand All @@ -69,11 +68,8 @@ public function testCanThrownAnOutOfBoundsExceptionWhenConstructingIfDatasAreMis
}

/**
* Test that an object can be constructed without data.
* Tests that an object can be constructed without data.
* @return void
*
* @test
* @covers ::__construct
*/
public function testCanBeConstructedWithEmptyDatas(): void
{
Expand All @@ -93,12 +89,10 @@ public function getOrderDatas(): array
}

/**
* Test that an object can be constructed with datas.
* Tests that an object can be constructed with datas.
* @param mixed[] $orderDatas order datas.
* @return void
*
* @test
* @covers ::__construct
* @covers ::addFromArray
* @uses \CyrilVerloop\Datatables\Order
* @uses \CyrilVerloop\Datatables\Orders
Expand All @@ -113,10 +107,9 @@ public function testCanBeConstructedWithDatas(array $orderDatas): void


/**
* Test that an order can be added.
* Tests that an order can be added.
* @return void
*
* @test
* @covers ::add
* @uses \CyrilVerloop\Datatables\Order
* @uses \CyrilVerloop\Datatables\Orders
Expand All @@ -135,10 +128,9 @@ public function testCanAdd(): void


/**
* Test that the iterator can be rewinded.
* Tests that the iterator can be rewinded.
* @return void
*
* @test
* @covers ::rewind
* @uses \CyrilVerloop\Datatables\Order
* @uses \CyrilVerloop\Datatables\Orders
Expand Down
21 changes: 7 additions & 14 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPUnit\Framework\TestCase;

/**
* Test the request for Datatables.
* Tests the request for Datatables.
* @package \Bundles\CrudBundle\Tests\Datatables
*
* @coversDefaultClass \CyrilVerloop\Datatables\Request
Expand Down Expand Up @@ -115,16 +115,14 @@ public function getParametersForConstructorRangeExceptions(): array
}

/**
* Test that an \RangeException is thrown when constructed.
* Tests that an \RangeException is thrown when constructed.
* @param mixed[] $columns the columns.
* @param mixed[] $order the order (column/direction).
* @param int $start the starting point.
* @param int $length the length.
* @param mixed[] $search the elements for the search.
* @return void
*
* @test
* @covers ::__construct
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
* @uses \CyrilVerloop\Datatables\Order
Expand All @@ -147,10 +145,9 @@ public function testConstructorCanThrowARangeException(


/**
* Test that no criteria is returned.
* Tests that no criteria is returned.
* @return void
*
* @test
* @covers ::getCriterias
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand All @@ -176,10 +173,9 @@ public function testCanGetEmptyCriteria(): void
}

/**
* Test that criterias are returned.
* Tests that criterias are returned.
* @return void
*
* @test
* @covers ::getCriterias
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand All @@ -198,11 +194,10 @@ public function testCanGetCriteria(): void


/**
* Test that an empty array is returned
* Tests that an empty array is returned
* if there is no order.
* @return void
*
* @test
* @covers ::getOrderBy
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand All @@ -225,11 +220,10 @@ public function testCanHaveEmptyOrderByWhenThereIsNoOrders(): void


/**
* Test that an exception is thrown
* Tests that an exception is thrown
* when it is impossible to order on a column.
* @return void
*
* @test
* @covers ::getOrderBy
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand Down Expand Up @@ -263,10 +257,9 @@ public function testCanThrowAnOutOfBoundsExceptionIfOrderByANonOrderablaColumn()


/**
* Test that the order is returned.
* Tests that the order is returned.
* @return void
*
* @test
* @covers ::getOrderBy
* @uses \CyrilVerloop\Datatables\Column
* @uses \CyrilVerloop\Datatables\Columns
Expand Down
Loading

0 comments on commit 7d20334

Please sign in to comment.