FOSSology  4.7.1
Open Source License Compliance by Open Source Software
AdminLicenseFileTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2026 Rajay Singh <rajaysingh2007@gmail.com>
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
9 
10 require_once(dirname(dirname(dirname(__DIR__))) . '/lib/php/Test/Reflectory.php');
11 require_once(dirname(dirname(dirname(__DIR__))) . '/lib/php/Plugin/FO_Plugin.php');
12 require_once(dirname(dirname(dirname(__DIR__))) . '/lib/php/common-plugin.php');
13 
24 class AdminLicenseFileTest extends \PHPUnit\Framework\TestCase
25 {
26  public static function provideTexts()
27  {
28  return [
29  'nomos' => ['License by Nomos.', true],
30  'ninka' => ['License by Ninka.', true],
31  'ojo' => ['License by OJO.', true],
32  'scancode' => ['License by Scancode.', true],
33  'real text' => ['Permission is hereby granted, free of charge, to any person', false],
34  ];
35  }
36 
42  public function testIsAgentPlaceholderText($text, $expected)
43  {
44  $GLOBALS['container'] = new class {
45  public function get($name)
46  {
47  return new \stdClass();
48  }
49  };
50  require_once(__DIR__ . '/../../ui/admin-license-file.php');
51  $page = (new \ReflectionClass('admin_license_file'))->newInstanceWithoutConstructor();
52 
53  $this->assertSame($expected,
54  Reflectory::invokeObjectsMethodnameWith($page, 'isAgentPlaceholderText', [$text]));
55  }
56 }
Test for admin_license_file::isAgentPlaceholderText() @runTestsInSeparateProcesses @preserveGlobalSta...
testIsAgentPlaceholderText($text, $expected)