public function testTypeMapperOnSave()
 {
     $this->deps->mapper->addTypeHandler(new TestTypeHandler(), 'varchar');
     $event = \Amiss\Demo\Active\EventRecord::getById(1);
     $event->save();
     $event = \Amiss\Demo\Active\EventRecord::getById(1);
     $this->assertEquals('zzHANDLEDzz', $event->name);
 }
Ejemplo n.º 2
0
 public function testCreateTable()
 {
     $deps = Test\Factory::managerNoteDefault();
     $deps->mapper->addTypeHandler(new \Amiss\Sql\Type\Autoinc(), 'autoinc');
     $deps->mapper->defaultTableNameTranslator = function ($name) {
         return 'test_' . $name;
     };
     try {
         \Amiss\Demo\Active\DemoRecord::_reset();
         \Amiss\Demo\Active\DemoRecord::setManager($deps->manager);
         TableBuilder::create($deps->connector, $deps->mapper, Demo\Active\EventRecord::class);
         $er = new Demo\Active\EventRecord();
         $er->name = 'foo bar';
         $er->slug = 'foobar';
         $er->save();
         $this->assertTrue(true);
     } finally {
         \Amiss\Demo\Active\DemoRecord::_reset();
     }
 }