/** * Method to perform sanity checks on the Table instance properties to ensure * they are safe to store in the database. * * @throws \UnexpectedValueException * @since 1.0 * * @return ProjectsTable */ public function check() { if (!$this->title) { throw new \UnexpectedValueException('A title is required'); } if (!$this->alias) { $this->alias = $this->title; } $this->alias = OutputFilter::stringURLSafe($this->alias); return $this; }
/** * Tests filtering strings down to ASCII-7 lowercase URL text * * @return void */ public function testStringURLSafe() { $this->assertEquals('1234567890-qwertyuiop-qwertyuiop-asdfghjkl-asdfghjkl-zxcvbnm-zxcvbnm', $this->object->stringURLSafe('`1234567890-=~!@#$%^&*()_+ qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;\'ASDFGHJKL:"zxcvbnm,./ZXCVBNM<>?'), 'Should clean keyboard string down to ASCII-7'); }