diff --git a/dibi/bridges/Tracy/Panel.php b/dibi/bridges/Tracy/Panel.php index d01d353f..efaccbda 100644 --- a/dibi/bridges/Tracy/Panel.php +++ b/dibi/bridges/Tracy/Panel.php @@ -13,7 +13,7 @@ use Tracy; /** * Dibi panel for Tracy. - * + * @package dibi\nette */ class Panel extends \DibiObject implements Tracy\IBarPanel { diff --git a/tests/dibi/DibiRow.phpt b/tests/dibi/DibiRow.phpt new file mode 100644 index 00000000..365e4450 --- /dev/null +++ b/tests/dibi/DibiRow.phpt @@ -0,0 +1,42 @@ +loadFile(__DIR__ . "/data/$config[system].sql"); + + +$row = $conn->fetch('SELECT * FROM [products] ORDER BY product_id'); + +// existing +Assert::same('Chair', $row->title); +Assert::true(isset($row->title)); +Assert::same('Chair', $row['title']); +Assert::true(isset($row['title'])); + + +// missing +Assert::error(function () use ($row) { + $x = $row->missing; +}, E_NOTICE, 'Undefined property: DibiRow::$missing'); + +Assert::error(function () use ($row) { + $x = $row['missing']; +}, E_NOTICE, 'Undefined property: DibiRow::$missing'); + +Assert::false(isset($row->missing)); +Assert::false(isset($row['missing'])); + + +// to array +Assert::same(array('product_id' => 1, 'title' => 'Chair'), iterator_to_array($row)); +Assert::same(array('product_id' => 1, 'title' => 'Chair'), $row->toArray()); + +// counting +Assert::same(2, count($row));