xibosignage / xibo

Xibo Digital Signage
https://xibosignage.com
GNU Affero General Public License v3.0
573 stars 165 forks source link

Phpunit - Display testing, work out how to make it work with xmr #809

Closed PeterMis closed 8 years ago

PeterMis commented 8 years ago

For API testing we do need display to have: XMR (screenshot) MAC address (WoL)

dasgarner commented 8 years ago

We most likely need to provide a dummy public key, channel and mac address

dasgarner commented 8 years ago

I've had a look at this and I think you need to create a display for your purposes using the XMDS wrapper, like:

$hardwareId = Random::generateString(12, 'phpunit');
$this->getXmdsWrapper()->RegisterDisplay($hardwareId, 
    'PHPUnit Test Display', 
    'windows', 
    null, 
    null, 
    null, 
    '<Fake mac>', 
    Random::generateString(50), 
    Random::generateString(50)
);

// Now find the Id of that Display
$displays = (new XiboDisplay($this->getEntityProvider()))->get();
$display = null;

foreach ($displays as $disp) {
    if ($disp->license == $hardwareId) {
        $display = $disp;
    }
}

if ($display === null) {
    $this->fail('Display was not added correctly');
}

// Use $display in your tests