toArray()['time']); self::assertEquals('', $obj->toArray()['title']); self::assertEquals('', $obj->toArray()['msg']); self::assertEquals(0, $obj->toArray()['stay']); self::assertEquals(NotifyType::INFO, $obj->toArray()['level']); } /** * @covers phpOMS\Model\Message\Notify * @group framework */ public function testSetGet() : void { $obj = new Notify('message', NotifyType::WARNING); $obj->delay = 3; $obj->stay = 5; $obj->level = NotifyType::ERROR; $obj->message ='msg'; $obj->title = 'title'; self::assertEquals([ 'type' => 'notify', 'time' => 3, 'stay' => 5, 'msg' => 'msg', 'title' => 'title', 'level' => NotifyType::ERROR, ], $obj->toArray()); self::assertEquals(\json_encode([ 'type' => 'notify', 'time' => 3, 'stay' => 5, 'msg' => 'msg', 'title' => 'title', 'level' => NotifyType::ERROR, ]), $obj->serialize()); self::assertEquals([ 'type' => 'notify', 'time' => 3, 'stay' => 5, 'msg' => 'msg', 'title' => 'title', 'level' => NotifyType::ERROR, ], $obj->jsonSerialize()); $obj2 = new Notify(); $obj2->unserialize($obj->serialize()); self::assertEquals($obj, $obj2); } }