Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -4,13 +4,13 @@ namespace tests\units\Sly\NotificationPusher\Adapter;
use mageekguy\atoum as Units;
use Sly\NotificationPusher\Adapter\Apns as TestedModel;
use Sly\NotificationPusher\Model\Message as BaseMessage;
use Sly\NotificationPusher\Model\Device as BaseDevice;
use Sly\NotificationPusher\Collection\DeviceCollection as BaseDeviceCollection;
use ZendService\Apple\Apns\Message as BaseServiceMessage;
use Sly\NotificationPusher\Collection\DeviceCollection;
use Sly\NotificationPusher\Model\Device as BaseDevice;
use Sly\NotificationPusher\Model\Message as BaseMessage;
use Sly\NotificationPusher\Model\Response;
use ZendService\Apple\Apns\Client\Message as BaseServiceClient;
use ZendService\Apple\Apns\Message as BaseServiceMessage;
/**
* Apns.
@@ -42,6 +42,7 @@ class Apns extends Units\Test
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
->and($object = new \Mock\Apns())
->and($object->setParameters(['certificate' => 'test.pem', 'passPhrase' => 'test']))
->and($object->setResponse(new Response()))
->array($object->getParameters())
->isNotEmpty()
->hasSize(2)
@@ -141,22 +142,26 @@ class Apns extends Units\Test
public function testPush()
{
$this->if($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
$this->if($this->mockGenerator()->orphanize('__construct')
->makeVisible('getOpenedServiceClient')
->generate(\Sly\NotificationPusher\Adapter\Apns::class, '\Mock', 'Apns'))
->and($object = new \Mock\Apns())
->and($object->setResponse(new Response()))
->and($this->mockClass('\ZendService\Apple\Apns\Response\Message', '\Mock\ZendService', 'Response'))
->and($this->mockClass(\ZendService\Apple\Apns\Response\Message::class, '\Mock\ZendService', 'Response'))
->and($serviceResponse = new \Mock\ZendService\Response())
->and($serviceResponse->getMockController()->getCode = \ZendService\Apple\Apns\Response\Message::RESULT_OK)
->and($serviceResponse->getMockController()->getId = 0)
->and($this->mockGenerator()->orphanize('__construct'))
->and($this->mockGenerator()->orphanize('open'))
->and($this->mockGenerator()->orphanize('send'))
->and($this->mockClass('\ZendService\Apple\Apns\Client\Message', '\Mock\ZendService'))
->and($this->mockGenerator()->orphanize('__construct')
->orphanize('open')
->orphanize('send')
->generate(\ZendService\Apple\Apns\Client\Message::class, '\Mock\ZendService'))
->and($serviceClient = new \Mock\ZendService\Message())
->and($serviceClient->getMockController()->send = new $serviceResponse)
->and($serviceClient->getMockController()->send = $serviceResponse)
->and($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Model\Push', '\Mock'))
->and($this->mockClass(\Sly\NotificationPusher\Model\Push::class, '\Mock'))
->and($push = new \Mock\Push())
->and($push->getMockController()->getMessage = new BaseMessage('Test'))
->and($push->getMockController()->getDevices = new BaseDeviceCollection(
@@ -165,11 +170,18 @@ class Apns extends Units\Test
->and($object->getMockController()->getServiceMessageFromOrigin = new BaseServiceMessage())
->and($object->getMockController()->getOpenedClient = $serviceClient)
->and($this->calling($object)->getOpenedServiceClient = $serviceClient)
->object($object->push($push))
->object($result = $object->push($push))
->isInstanceOf('\Sly\NotificationPusher\Collection\DeviceCollection')
->hasSize(1)
;
->boolean($result->count() == 1)
->isTrue();
}
public function testCountIsEmpty() {
$this->if($dcoll = new DeviceCollection())
->boolean($dcoll->isEmpty())
->isTrue();
}
public function testFeedback()

View File

@@ -9,6 +9,7 @@ use Sly\NotificationPusher\Model\Message as BaseMessage;
use Sly\NotificationPusher\Model\Device as BaseDevice;
use Sly\NotificationPusher\Collection\DeviceCollection as BaseDeviceCollection;
use Sly\NotificationPusher\Model\Response;
use ZendService\Google\Gcm\Client as BaseServiceClient;
use ZendService\Google\Gcm\Message as BaseServiceMessage;
@@ -74,11 +75,11 @@ class Gcm extends Units\Test
->array($definedParameters = $object->getDefinedParameters())
->isNotEmpty()
->containsValues([
'collapse_key',
'delay_while_idle',
'time_to_live',
'restricted_package_name',
'dry_run'
'collapseKey',
'delayWhileIdle',
'ttl',
'restrictedPackageName',
'dryRun'
]);
}
@@ -128,17 +129,48 @@ class Gcm extends Units\Test
public function testGetServiceMessageFromOrigin()
{
$this->if($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
->and($this->mockClass(\Sly\NotificationPusher\Adapter\Gcm::class, '\Mock'))
->and($object = new \Mock\Gcm())
->and($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Model\Message', '\Mock'))
->and($this->mockClass(\Sly\NotificationPusher\Model\Message::class, '\Mock'))
->and($message = new \Mock\Message())
->and($message->getMockController()->getOptions = [
'param' => 'test',
'notificationData' => ['some' => 'foobar']
])
->and($message->getMockController()->getText = 'Test')
->object($object->getServiceMessageFromOrigin([self::GCM_TOKEN_EXAMPLE], $message))
->isInstanceOf('\ZendService\Google\Gcm\Message')
;
->object($originalMessage = $object->getServiceMessageFromOrigin([self::GCM_TOKEN_EXAMPLE], $message))
->isInstanceOf(\ZendService\Google\Gcm\Message::class)
->array($originalMessage->getData())
->notHasKey('notificationData')
->array($originalMessage->getNotification())
->hasKey('some')
->contains('foobar');
}
public function testGcmMessageUse()
{
$this->if($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass(\Sly\NotificationPusher\Adapter\Gcm::class, '\Mock'))
->and($object = new \Mock\Gcm())
->and($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass(\Sly\NotificationPusher\Model\GcmMessage::class, '\Mock'))
->and($message = new \Mock\GcmMessage())
->and($message->getMockController()->getNotificationData = [
'some' => 'foobar'
])
->and($message->getMockController()->getText = 'Test')
->object($originalMessage = $object->getServiceMessageFromOrigin([self::GCM_TOKEN_EXAMPLE], $message))
->isInstanceOf(\ZendService\Google\Gcm\Message::class)
->array($originalMessage->getData())
->notHasKey('notificationData')
->array($originalMessage->getNotification())
->hasKey('some')
->contains('foobar');
}
public function testPush()
@@ -146,6 +178,7 @@ class Gcm extends Units\Test
$this->if($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
->and($object = new \Mock\Gcm())
->and($object->setResponse(new Response()))
->and($this->mockClass('\ZendService\Google\Gcm\Response', '\Mock\ZendService'))
->and($serviceResponse = new \Mock\ZendService\Response())

View File

@@ -20,7 +20,9 @@ class Message extends Units\Test
->array($object->getOptions())->isEmpty()
;
$this->if($object = new TestedModel('Test', ['param' => 'test']))
$this->if($object = new TestedModel('Test', [
'param' => 'test',
]))
->string($object->getText())->isEqualTo('Test')
->when($object->setText('Test 2'))
->string($object->getText())->isEqualTo('Test 2')

View File

@@ -62,6 +62,7 @@ class Push extends Units\Test
public function testStatus()
{
date_default_timezone_set('UTC');
$this->if($this->mockClass('\Sly\NotificationPusher\Adapter\AdapterInterface', '\Mock'))
->and($adapter = new \Mock\AdapterInterface())
->and($devices = new BaseDeviceCollection([new BaseDevice('Token1'), new BaseDevice('Token2'), new BaseDevice('Token3')]))
@@ -81,7 +82,7 @@ class Push extends Units\Test
->boolean($object->isPushed())
->isTrue()
->dateTime($object->getPushedAt())
->isCloneOf($dt)
->hasDate($dt->format("Y"), $dt->format("m"), $dt->format('d'))
->when($object->setStatus(TestedModel::STATUS_PENDING))
->string($object->getStatus())
@@ -92,7 +93,7 @@ class Push extends Units\Test
->when($fDt = new \DateTime('2013-01-01'))
->and($object->setPushedAt($fDt))
->dateTime($object->getPushedAt())
->isCloneOf(new \DateTime('2013-01-01'))
->isIdenticalTo($fDt)
;
}
@@ -162,4 +163,5 @@ class Push extends Units\Test
->isEqualTo('Test 2')
;
}
}

View File

@@ -3,6 +3,7 @@
namespace tests\units\Sly\NotificationPusher;
use mageekguy\atoum as Units;
use Sly\NotificationPusher\Model\Response;
use Sly\NotificationPusher\PushManager as TestedModel;
use Sly\NotificationPusher\Model\Message as BaseMessage;
@@ -38,22 +39,38 @@ class PushManager extends Units\Test
->and($push = new \Mock\Push())
->and($push->getMockController()->getMessage = new BaseMessage('Test'))
->and($push->getMockController()->getDevices = new BaseDeviceCollection([new BaseDevice(self::APNS_TOKEN_EXAMPLE)]))
->and($push2 = new \Mock\Push())
->and($push2->getMockController()->getMessage = new BaseMessage('Test 2'))
->and($push2->getMockController()->getDevices = new BaseDeviceCollection([new BaseDevice(self::APNS_TOKEN_EXAMPLE)]))
->and($object = new TestedModel())
->and($object = (new TestedModel())->getPushCollection())
->when($object->add($push))
->object($object)
->isInstanceOf('\Sly\NotificationPusher\Collection\PushCollection')
->object($object->getIterator())
->hasSize(1)
->when($object->add($push2))
->object($object)
->isInstanceOf('\Sly\NotificationPusher\Collection\PushCollection')
->object($object->getIterator())
->hasSize(2)
->object($object->first())
->isEqualTo($push)
->object($object->last())
->isEqualTo($push2)
;
}
public function testPush()
{
date_default_timezone_set('UTC');
$this->if($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
->and($apnsAdapter = new \Mock\Apns())
->and($apnsAdapter->getMockController()->push = true)
->and($apnsAdapter->getMockController()->getResponse = new Response())
->and($this->mockGenerator()->orphanize('__construct'))
->and($this->mockClass('\Sly\NotificationPusher\Model\Push', '\Mock'))
@@ -68,6 +85,8 @@ class PushManager extends Units\Test
->object($object->push())
->isInstanceOf('\Sly\NotificationPusher\Collection\PushCollection')
->hasSize(1)
->object($object->getResponse())
->isInstanceOf('\Sly\NotificationPusher\Model\Response')
;
}
}