/** * Test alias generator * * @dataProvider provideTitleAlias */ public function testSetAliasFromTitle($title, $alias) { $page = new Default_Model_Page(); $page->setTitle($title); $page->setAliasFromTitle(); $this->assertEquals($alias, $page->getAlias()); }
public function testSave() { $request = array('title' => 'foo', 'content' => 'some content', 'language' => 'bar'); $model = new Default_Model_Page($request); $model->setAliasFromTitle(); $form = $this->getMock('Zend_Form', array('isValid', 'getValues')); $form->expects($this->once())->method('isValid')->will($this->returnValue(true)); $form->expects($this->once())->method('getValues')->will($this->returnValue($request)); $mapper = $this->getMock('Mapper', array('save')); $mapper->expects($this->once())->method('save')->with($model); $service = new Default_Service_Page(); $service->setForm($form); $service->setMapper($mapper); $service->save($request); }