session->set( 'messages.' . $type->value, array_merge($this->session->get('messages.' . $type->value, []), (array) $value) ); } protected function assertHasNotification(string $value, NotificationType $type = NotificationType::MESSAGE): void { $messages = $this->session->get('messages.' . $type->value, []); $this->assertTrue(in_array($value, $messages), 'Has ' . $type->value . ' notification: ' . $value); } protected function assertHasNoNotifications(NotificationType $type = null): void { $messages = $this->session->get('messages' . ($type ? '.' . $type->value : ''), []); $this->assertEmpty($messages, 'Has no' . ($type ? ' ' . $type->value : '') . ' notification.'); } /** * Setup environment */ public function setUp(): void { parent::setUp(); $this->initDatabase(); $this->request = Request::create('http://localhost'); $this->app->instance('request', $this->request); $this->app->instance(Request::class, $this->request); $this->app->instance(ServerRequestInterface::class, $this->request); $this->response = $this->createMock(Response::class); $this->app->instance(Response::class, $this->response); $this->log = new TestLogger(); $this->app->instance(LoggerInterface::class, $this->log); $this->session = new Session(new MockArraySessionStorage()); $this->app->instance('session', $this->session); $this->app->instance(Session::class, $this->session); $this->app->instance(SessionInterface::class, $this->session); $this->app->bind(UrlGeneratorInterface::class, UrlGenerator::class); $this->config = new Config(); $this->app->instance('config', $this->config); $this->app->instance(Config::class, $this->config); } }