Skip to content

Commit 51097bd

Browse files
committed
! Travis & fixed unit tests
1 parent 9834b7b commit 51097bd

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

  • src/app/code/community/FireGento/AdminMonitoring/Test/Model

src/app/code/community/FireGento/AdminMonitoring/Test/Model/Observer.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class FireGento_AdminMonitoring_Test_Model_Observer extends EcomDev_PHPUnit_Test_Case
2929
{
3030
/**
31-
* @var FireGento_AdminMonitoring_Model_Observer
31+
* @var FireGento_AdminMonitoring_Model_Observer_Model_Save
3232
*/
3333
protected $_object;
3434

@@ -38,7 +38,7 @@ class FireGento_AdminMonitoring_Test_Model_Observer extends EcomDev_PHPUnit_Test
3838
protected function setUp()
3939
{
4040
parent::setUp();
41-
$this->_object = Mage::getModel('firegento_adminmonitoring/observer');
41+
$this->_object = Mage::getModel('firegento_adminmonitoring/observer_model_save');
4242

4343
// set admin/session
4444
$this->_setAdminSession();
@@ -83,7 +83,7 @@ public function testNoHistorySaves()
8383
$mock->expects($this->never())->method('save');
8484
$this->replaceByMock('model', 'firegento_adminmonitoring/history', $mock);
8585

86-
Mage::getModel('firegento_adminmonitoring/observer')->modelSaveAfter($observer);
86+
$this->_object->modelAfter($observer);
8787
}
8888

8989
/**
@@ -94,11 +94,12 @@ public function testNoHistorySaves()
9494
public function testHistorySavesWithCustomer(
9595
$id, $mail = null, $firstname = null, $lastname = null, $password = null
9696
) {
97+
/* @var $customer Mage_Customer_Model_Customer */
9798
$customer = Mage::getModel('customer/customer');
99+
98100
if ($id !== null) {
99101
$customer->load($id);
100102
}
101-
102103
if (!empty($mail)) {
103104
$customer->setEmail($mail);
104105
}
@@ -112,22 +113,25 @@ public function testHistorySavesWithCustomer(
112113
$customer->setPasswordHash($password);
113114
}
114115

115-
116116
$data = array('object' => $customer);
117117
$observer = $this->_createObserver($data);
118118

119119
$mock = $this->getModelMock('firegento_adminmonitoring/history', null);
120120
$mock->expects($this->once())->method('save');
121121
$this->replaceByMock('model', 'firegento_adminmonitoring/history', $mock);
122-
$this->_object->modelSaveBefore($observer);
123-
$this->_object->modelSaveAfter($observer);
122+
123+
$this->_object->modelBefore($observer);
124+
$this->_object->modelAfter($observer);
124125
$data = $mock->getData();
126+
125127
$this->assertRegExp('#^[0-9]*$#', $mock->getHistoryId());
126128
$this->assertRegExp(
127129
'/^([0-9]{2,4})-([0-1][0-9])-([0-3][0-9]) (?:([0-2][0-9]):([0-5][0-9]):([0-5][0-9]))?$/',
128130
$mock->getCreatedAt()
129131
);
132+
130133
unset($data['created_at'], $data['history_id']); // remove changing attributes
134+
131135
$this->assertEquals(
132136
$this->expected("$id-$mail-$firstname-$lastname-$password")->getData(),
133137
$data

0 commit comments

Comments
 (0)