Esempio n. 1
0
 public function nonIntegerIdentifier()
 {
     $id = 'non-integer-one';
     $binaryData = "!bbq!";
     $bin = TestBinaryStuff::create()->setId($id)->setData($binaryData);
     try {
         TestBinaryStuff::dao()->import($bin);
     } catch (DatabaseException $e) {
         return $this->fail();
     }
     Cache::me()->clean();
     $prm = Primitive::prototypedIdentifier('TestBinaryStuff', 'id');
     $this->assertTrue($prm->import(array('id' => $id)));
     $this->assertSame($prm->getValue()->getId(), $id);
     $binLoaded = TestBinaryStuff::dao()->getById($id);
     $this->assertEquals($binLoaded, $bin);
     $this->assertEquals($binLoaded->getData(), $binaryData);
     $this->assertEquals(TestBinaryStuff::dao()->dropById($id), 1);
     $integerIdPrimitive = Primitive::prototypedIdentifier('TestUser');
     try {
         $integerIdPrimitive->import(array('id' => 'string-instead-of-integer'));
     } catch (DatabaseException $e) {
         return $this->fail();
     }
 }