Example #1
0
 public function testPutExpected()
 {
     $id = intval(getenv('ITEM_ID'));
     $item = new Item(getenv('DY_TABLE'));
     $item['id'] = $id;
     $item['name'] = 'test';
     $item['strings'] = array('test1', 'test2');
     $item['numbers'] = array(4, 5, 6);
     $this->conn->put($item);
     $expected = new Expected();
     $expected['strings'] = new ExpectedAttribute(array('test1', 'test2'));
     $expected['non_existent'] = new ExpectedAttribute(false);
     $context = new Context\Put();
     $context->setExpected($expected);
     $context->setReturnValues(ReturnValue::ALL_OLD);
     $newItem = new Item(getenv('DY_TABLE'));
     $newItem['id'] = $id;
     $newItem['name'] = 'test';
     $newItem['strings'] = array('test1', 'test2', 'test3');
     $newItem['numbers'] = array(4, 5, 6, 7, 8, 9);
     $attributes = $this->conn->put($item, $context);
     $this->assertNotNull($attributes);
 }