prestashop-module/tests/RetailcrmDaemonCollectorTest.php

41 lines
958 B
PHP
Raw Normal View History

2019-01-18 17:04:32 +03:00
<?php
class RetailcrmDaemonCollectorTest extends RetailcrmTestCase
{
const KEY = 'test-key';
const ID = '1';
public function testBuildJsWithCustomer()
{
$customer = new Customer;
$customer->id = self::ID;
$collector = new RetailcrmDaemonCollector(
$customer,
self::KEY
);
$js = $collector->buildScript()->getJs();
$this->assertContains('customerId', $js);
$this->assertContains('<script', $js);
$this->assertContains('</script>', $js);
}
public function testBuildJsWithoutCustomer()
{
$customer = new Customer;
$collector = new RetailcrmDaemonCollector(
$customer,
self::KEY
);
$js = $collector->buildScript()->getJs();
$this->assertNotContains('customerId', $js);
$this->assertContains('<script', $js);
$this->assertContains('</script>', $js);
}
}