2
0
forked from Wavyzz/dolibarr

Qual: Enable phan on modulebuilder (#30652)

* Allow null for buyer, and force '' for  in printObjectLine(s)

* Allow null for Contact in show_actions_done

* Qual: Enable phan on modulebuilder

# Qual: Enable phan on modulebuilder

Most files of the modulebuilder template can be checked as regular files.
It will help improve the template

* Update baseline (enable modulebuilder notices)

* Add properties that are expected to exist on modules_boxes

* Qual: Ignore false positive (phan)

* Set phpdoc type to include null on formAddObjectLine

* Qual: Fixes for modulebuilder (phan, phpstan, bugs, format)

* Fix phpcs for intracom

* Make ModeleBoxes:showBox() signature match child class's

* Fix *box::showBox() phpdoc types

* Update index.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW
2024-08-18 18:16:08 +02:00
committed by GitHub
parent 4e2842ca27
commit b0087aaf61
111 changed files with 1266 additions and 1019 deletions

View File

@@ -1,8 +1,7 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
* Copyright (C) ---Replace with your own copyright and developer email---
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,12 +46,25 @@ $langs->load("main");
* @backupGlobals disabled
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
* @phan-file-suppress PhanCompatibleVoidTypePHP70
*/
class MyObjectTest extends PHPUnit\Framework\TestCase
class MyObjectTest extends PHPUnit\Framework\TestCase // @phan-suppress-current-line PhanUndeclaredExtendedClass
{
/**
* @var Conf Saved configuration object
*/
protected $savconf;
/**
* @var User Saved User object
*/
protected $savuser;
/**
* @var Translate Saved translations object (from $langs)
*/
protected $savlangs;
/**
* @var DoliDB Saved database object
*/
protected $savdb;
/**
@@ -63,7 +75,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
*/
public function __construct($name = '')
{
parent::__construct($name);
parent::__construct($name); // @phan-suppress-current-line PhanUndeclaredClass
//$this->sharedFixture
global $conf, $user, $langs, $db;
@@ -80,7 +92,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
/**
* Global test setup
*
* @return void
* @return void No return value
*/
public static function setUpBeforeClass(): void
{
@@ -93,7 +105,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
/**
* Unit test setup
*
* @return void
* @return void No return value
*/
protected function setUp(): void
{
@@ -109,7 +121,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
/**
* Unit test teardown
*
* @return void
* @return void No return value
*/
protected function tearDown(): void
{
@@ -119,7 +131,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
/**
* Global test teardown
*
* @return void
* @return void No return value
*/
public static function tearDownAfterClass(): void
{
@@ -134,6 +146,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
* A sample test
*
* @return bool
* @phan-suppress PhanUndeclaredMethod
*/
public function testSomething()
{
@@ -145,7 +158,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
$result = true;
print __METHOD__." result=".$result."\n";
print __METHOD__." result=".((int) $result)."\n";
$this->assertTrue($result);
return $result;
@@ -155,6 +168,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
* testMyObjectCreate
*
* @return int
* @phan-suppress PhanUndeclaredMethod
*/
public function testMyObjectCreate()
{
@@ -182,6 +196,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
*
* @depends testMyObjectCreate
* The depends says test is run only if previous is ok
* @phan-suppress PhanUndeclaredMethod
*/
public function testMyObjectDelete($id)
{
@@ -199,4 +214,4 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
$this->assertLessThan($result, 0);
return $result;
}
}
} // @phan-suppress-current-line PhanUndeclaredClass