public function testShowAction() { $this->createsModels = true; $language = new Opus_Language(); $language->setActive(true); $language->setRefName('German'); $language->setPart2T('deu'); $language->setPart2B('ger'); $language->setPart1('de'); $language->setScope('I'); $language->setType('L'); $language->setComment('test comment'); $modelId = $language->store(); $this->dispatch('/admin/language/show/id/' . $modelId); $model = new Opus_Language($modelId); $model->delete(); $this->assertResponseCode(200); $this->assertController('language'); $this->assertAction('show'); $this->assertQueryContentRegex('div#Active', '/Yes|Ja/'); $this->assertQueryContentContains('div#RefName', 'German'); $this->assertQueryContentContains('div#Part2T', 'deu'); $this->assertQueryContentContains('div#Part2B', 'ger'); $this->assertQueryContentContains('div#Part1', 'de'); $this->assertQueryContentRegex('div#Scope', '/Individual|Individuell/'); $this->assertQueryContentRegex('div#Type', '/Living|Lebend/'); $this->assertQueryContentContains('div#Comment', 'test comment'); // TODO $this->validateXHTML(); }
public function testPopulateFromModel() { $form = new Admin_Form_Language(); $language = new Opus_Language(); $language->setActive(true); $language->setPart2B('ger'); $language->setPart2T('deu'); $language->setRefName('German'); $language->setPart1('de'); $language->setScope('M'); $language->setType('H'); $language->setComment('test comment'); $form->populateFromModel($language); $this->assertTrue($form->getElement('Active')->getValue()); $this->assertEquals('ger', $form->getElement('Part2B')->getValue()); $this->assertEquals('deu', $form->getElement('Part2T')->getValue()); $this->assertEquals('de', $form->getElement('Part1')->getValue()); $this->assertEquals('German', $form->getElement('RefName')->getValue()); $this->assertEquals('test comment', $form->getElement('Comment')->getValue()); $this->assertEquals('M', $form->getElement('Scope')->getValue()); $this->assertEquals('H', $form->getElement('Type')->getValue()); $this->assertNull($form->getElement('Id')->getValue()); }