/** * @depends testCreateAndGetAutoresponderItemById */ public function testRequiredAttributes() { $autoresponderItem = new AutoresponderItem(); $this->assertFalse($autoresponderItem->unrestrictedSave()); $errors = $autoresponderItem->getErrors(); $this->assertNotEmpty($errors); $this->assertCount(1, $errors); $this->assertArrayHasKey('processDateTime', $errors); $this->assertEquals('Process Date Time cannot be blank.', $errors['processDateTime'][0]); $time = DateTimeUtil::convertTimestampToDbFormatDateTime(strtotime('+1 week')); $autoresponderItem = new AutoresponderItem(); $autoresponderItem->processed = AutoresponderItem::PROCESSED; $autoresponderItem->processDateTime = $time; $this->assertTrue($autoresponderItem->unrestrictedSave()); $id = $autoresponderItem->id; unset($autoresponderItem); $autoresponderItem = AutoresponderItem::getById($id); $this->assertEquals(AutoresponderItem::PROCESSED, $autoresponderItem->processed); $this->assertEquals($time, $autoresponderItem->processDateTime); }