Ejemplo n.º 1
0
 public function testShouldCopyToUser()
 {
     //THEN
     $this->_oIssueSetMock->expects($this->once())->method('copyToUser')->with($this->equalTo($this->_oUser));
     //WHEN
     $this->_oApplication->copyToUser($this->_oUser);
     $this->_oApplication->refresh();
     //THEN
     $this->assertEquals(2, $this->_oApplication->client, 'Client id should change');
     $oGivenDataSet = $this->getConnection()->createQueryTable('application', 'SELECT id, client FROM application ORDER BY id');
     $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/copy.xml')->getTable('application');
     $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet);
 }
Ejemplo n.º 2
0
 public function testShouldNotMoveToSameUserClient()
 {
     //GIVEN
     //Get the user with the same client id
     $oUser = AM_Model_Db_Table_Abstract::factory('user')->findOneBy(array('id' => 3));
     //THEN
     $this->_oIssueSetMock->expects($this->never())->method('moveToUser');
     //WHEN
     $this->_oApplication->moveToUser($oUser);
     $this->_oApplication->refresh();
     //THEN
     $this->assertEquals(1, $this->_oApplication->client, 'Client id should not change');
     $oGivenDataSet = $this->getConnection()->createQueryTable('application', 'SELECT id, client FROM application ORDER BY id');
     $oExpectedDataSet = $this->createFlatXMLDataSet(dirname(__FILE__) . '/_dataset/not_move.xml')->getTable('application');
     $this->assertTablesEqual($oExpectedDataSet, $oGivenDataSet);
 }