Unrecognized object error in Stargazer with Portmanteau Test? - unit-testing

Could someone please help me in understanding why I get this error with the stargazer function in R?
This is my code
Serial1<-serial.test(Modeldataset1, lags.pt=12,type="PT.asymptotic")
Serial1
stargazer(Serial1, type = "latex", title="Table 5: Portmanteau Test Results")

Related

PHPUnit test in Zend Framework 3

I am trying to create a test case on the login action with 2 post parameter the code is as here
namespace UserTest\Controller;
use Application\Controller\LoginController;
use Application\Service\AuthenticationService;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Parameters;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
class UserControllerTest extends AbstractHttpControllerTestCase
public function testIndexActionCanBeAccessed()
{
$p = new Parameters();
$p->set('username','foo');
$p->set('password','bar');
$this->getRequest()->setMethod('POST');
$this->getRequest()->setPost($p);
$this->dispatch('widget/login');
$this->assertModuleName('Application');
$this->assertControllerName(LoginController::class);
$this->assertControllerClass('LoginController');
//$this->assertMatchedRouteName('login');
}
and executing the test case from the command line the command is
./vendor/bin/phpunit
/var/www/myproject/application/module/Application/test/Controller/UserControllerTest.php
and the script throwing error that is
Fatal error: Declaration of Application\Service\AuthenticationService::authenticate() must be compatible with Zend\Authentication\AuthenticationService::authenticate(?Zend\Authentication\Adapter\AdapterInterface $adapter = NULL) in /var/www/myproject/application/module/Application/src/Application/Service/AuthenticationService.php on line 16
Please, help me to fix this issue and let me know what i am doing wrong in it

CONCAT with COUNT, SUM,

In a complex query, I have a subquery to count/summarize children:
->addSelect('(SELECT CONCAT(COUNT(c.id), \'|\', SUM(c.field1), \'|\', SUM(c.field2), \'|\', SUM(c.field3)) FROM App\Entity\Child c WHERE c.parent = p.id GROUP BY c.parent)')
This query worked perfectly until I upgraded to the new version of Symfony (4.2) and doctrine orm 2.6.1. I got the following error:
[Syntax Error] line 0, col 25: Error: Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got 'COUNT'
I tried to use CAST ... AS CHAR(25) but it doesn't work (got the same error).
Anyone can help me please?
Best regards,
Jonathan
Looks Like it is regression in doctrine StringPrimary parser function.
After looking at code I have made comment with my observation in issue related to this problem (while not entierly describing it).
Essentially new function missing this part, and defaulting to error when encountering any aggregate functions:
default:
if ($this->isAggregateFunction($lookaheadType)) {
return $this->AggregateExpression();
}
PS. link to the related issue:
https://github.com/doctrine/doctrine2/issues/7205
I found a workaround: I install doctrine extensions and I replace CONCAT by CONCAT_WS (DoctrineExtensions\Query\Mysql\ConcatWs).
Best regards

Getting fatal error: unexpectedly found nil while unwrapping an Optional value [duplicate]

This question already has answers here:
What does "Fatal error: Unexpectedly found nil while unwrapping an Optional value" mean?
(16 answers)
Closed 5 years ago.
MapPinAnnotation is a class of MKAnnotation type in which I have defined
var lblNotificationCount:UILabel!
I want to set text at label but getting error as described below: -
let storeAnnotation = annotation as! MapPinAnnotation
and in console i am able to get value of count but it print error as below: -
Console Output:
Count: 1
fatal error: unexpectedly found nil while unwrapping an Optional value
Please help, how to resolve this issue. Thanks in advance.
This might be helpful:
storeAnnotation.lblNotificationCount.text = String(describing: count)

converting for and if statements to list comprehensions in python

I'm trying to incorporate list comprehensions in my code, for ease of understanding's and efficiency's sake.
My code is this:
for tblock in jdata['network']['tcp']:
if not [tblock['dst'], tblock['dport']] in test:
test.append([tblock['dst'], tblock['dport']])
test = [ip for ip in test if not ip[0].startswith(fil2)]
The error I am getting is on the test.append part. Below is just a cobbled together attempt, as I dont know how to bring in the test.append portion.
test = [tblock for tblock in jdata['network']['tcp'] if not [tblock['dst'], tblock['dport']] in test if test > 0 test.append([tblock['dst'], tblock['dport']])]
SyntaxError: invalid syntax
For context, fil2 is a list of IP's that filters against the information. I can provide test data if anyone needs it.

How to Mole SPFieldUser from SPField

Im writing the unit test case using Moles for my SharePoint application
I'm stuck up at the below lines of code I'm unable to type cast SPField to SPFieldUser.
SField subfield = list.Fields.GetField("Subscriber");
SPFieldUser userfield = (SPFieldUser)subfield;
userfield.SelectionGroup = web.Groups["Focal Points"].ID; //error line shown in pex
I'm getting "NullReference" exception at the above line
Can someone guide me here..
Although I am sure you have already checked these...:
Does GetField("Subscriber") return an object?
Does userfield get set to an object?
Is userfield.SelectionGroup null?
Try this syntax:
SPFieldUser userfield = subfield as SPFieldUser;
So, these all fail. Let's examine covariance of SPFieldUser to SField. The inheritance hierarchy is:
System.Object
Microsoft.SharePoint.SPField
Microsoft.SharePoint.SPFieldLookup
Microsoft.SharePoint.SPFieldUser
Unfortunately, I do not have the Microsoft.SharePoint library, to see if the SPFieldLookup classis hiding something important in SPField.