* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development:testing:unit_tests Wiki */ namespace VuFindTest; use VuFindTheme\Mobile; /** * Mobile Test Class * * @category VuFind * @package Tests * @author Demian Katz * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development:testing:unit_tests Wiki */ class ThemeMobileTest extends \PHPUnit\Framework\TestCase { /** * Test namespace stripping. * * @return void */ public function testEnable() { $mobile = new Mobile(); // default behavior $this->assertFalse($mobile->enabled()); // turn on $mobile->enable(); $this->assertTrue($mobile->enabled()); // turn off $mobile->enable(false); $this->assertFalse($mobile->enabled()); } /** * Test detection wrapping. * * @return void */ public function testDetection() { $detector = $this->getMockBuilder(\uagent_info::class) ->onlyMethods(['DetectMobileLong']) ->getMock(); $detector->expects($this->once()) ->method('DetectMobileLong')->will($this->returnValue(true)); $mobile = new Mobile($detector); $this->assertTrue($mobile->detect()); } }