public function testUpdateWithGroup() { $group = 'group'; $viewsMock = $this->getViewsMock(); $viewsMock->expects($this->never())->method('getItems'); $viewsMock->expects($this->once())->method('getItemsByColumnValue')->with($group)->will($this->returnValue($this->getViews('update'))); $this->model->update($group); }
/** * @expectedException Mage_Core_Exception * @expectedExceptionMessage The address with the specified ID not found. */ public function testPrepareCustomerAddressForSaveException() { $this->_customer->expects($this->any())->method('getId')->will($this->returnValue(1)); $address = $this->_createAddress(true, 1); $this->_customer->expects($this->once())->method('getAddressItemById')->with($address->getId())->will($this->returnValue(false)); $this->_service->update(1, array(), array(array('entity_id' => 1, 'city' => 'test'))); }
/** * @expectedException \Magento\Framework\Exception\CouldNotSaveException */ public function testUpdateValidateException() { $id = 3; $categorySdo = $this->getMockBuilder('Magento\\Catalog\\Service\\V1\\Data\\Category')->disableOriginalConstructor()->getMock(); $this->category->expects($this->once())->method('getId')->will($this->returnValue($id)); $this->category->expects($this->once())->method('validate')->will($this->returnValue(['Validation error'])); $this->model->update($id, $categorySdo); }
/** * @test * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException */ public function updateRejectsObjectsOfWrongType() { $this->repository->_set('objectType', 'Foo'); $this->repository->update(new \stdClass()); }
/** * @test * @dataProvider updateQueriesDataProvider * @param array $args * @param string $expectedQuery * @param array $expectedValues * @param array $expectedTypes */ public function updateQueries(array $args, string $expectedQuery, array $expectedValues, array $expectedTypes) { $this->connection->expects($this->once())->method('executeUpdate')->with($expectedQuery, $expectedValues, $expectedTypes)->will($this->returnValue(1)); $this->connection->update(...$args); }
/** * @test * * @expectedException \BadMethodCallException */ public function updateThrowsException() { $this->subject->update(new AbstractEntity()); }