From 5d8fda717d556aefaa0154928d35288a7d98f23f Mon Sep 17 00:00:00 2001 From: Alangi Derick Date: Tue, 20 Nov 2018 17:35:47 +0100 Subject: [PATCH] Add PHPUnit tests for methods in ViewAction::class * makeViewActionClassFactory() - helper function to create an instance of the ViewAction class and return it. * testGetName() - covers the getName() method in ViewAction class. * testOnView() - covers the onView() method in ViewAction class. Change-Id: I1c84c8f51d96386196a1c0b44a209f90ddd8e716 --- .../includes/actions/ViewActionTest.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/phpunit/includes/actions/ViewActionTest.php diff --git a/tests/phpunit/includes/actions/ViewActionTest.php b/tests/phpunit/includes/actions/ViewActionTest.php new file mode 100644 index 0000000000..5f659c07a2 --- /dev/null +++ b/tests/phpunit/includes/actions/ViewActionTest.php @@ -0,0 +1,35 @@ +makeViewActionClassFactory(); + $actual = $viewAction->getName(); + + $this->assertSame( 'view', $actual ); + } + + public function testOnView() { + $viewAction = $this->makeViewActionClassFactory(); + $actual = $viewAction->onView(); + + $this->assertNull( $actual ); + } +} -- 2.20.1