public function testPost()
 {
     $budgetaryItemRepoMock = \Phake::mock('myfinance\\repositories\\BudgetaryItemRepository');
     $controller = new BudgetaryController($budgetaryItemRepoMock);
     $json = '{"description":"Autoausgaben"}';
     $controller->post(json_decode($json));
     \Phake::verify($budgetaryItemRepoMock)->create(\Phake::ignoreRemaining());
 }
 public function testPost()
 {
     $accountingEntryRepoMock = \Phake::mock('myfinance\\repositories\\AccountingEntryRepository');
     $controller = new AccountingEntryController($accountingEntryRepoMock);
     $json = '{"amount":"12.15",description":"Reperatur bei Autohaus","date":"2015-09-03","account":"1","category","2"}';
     $controller->post(json_decode($json));
     \Phake::verify($accountingEntryRepoMock)->create(\Phake::ignoreRemaining());
 }
 public function testPost()
 {
     $accountRepoMock = \Phake::mock('myfinance\\repositories\\AccountRepository');
     $controller = new AccountController($accountRepoMock);
     $json = '{"description":"LUKB von User1","saldo":"0.00"}';
     $controller->post(json_decode($json));
     \Phake::verify($accountRepoMock)->create(\Phake::ignoreRemaining());
 }
 public function testPost()
 {
     $categoryMock = \Phake::mock('myfinance\\repositories\\CategoryRepository');
     $controller = new CategoryController($categoryMock);
     $json = '{"type":"1","description":"Bargeldbezug","budgetaryItem":"2"}';
     $controller->post(json_decode($json));
     \Phake::verify($categoryMock)->create(\Phake::ignoreRemaining());
 }
 public function testPost()
 {
     $quotaMock = \Phake::mock('myfinance\\repositories\\QuotaRepository');
     $controller = new QuotaController($quotaMock);
     $json = '{"value":"10000","monthNumber":"3","yearNumber":"2015","budgetaryItem":"2"}';
     $controller->post(json_decode($json));
     \Phake::verify($quotaMock)->create(\Phake::ignoreRemaining());
 }
 public function testDeleteByNegativeIdExpectException()
 {
     $quotaMock = \Phake::mock('myfinance\\model\\Quota');
     $contextMock = \Phake::mock('myfinance\\FinanceContext');
     $dbMock = \Phake::mock('myfinance\\db\\MysqlDB');
     \Phake::when($contextMock)->getUser()->thenReturn(\Phake::mock('myfinance\\model\\User'));
     \Phake::when($contextMock)->getDb()->thenReturn($dbMock);
     \Phake::when($dbMock)->query(\Phake::ignoreRemaining())->thenReturn(false);
     \Phake::when($dbMock)->get($quotaMock->id)->thenReturn($quotaMock);
     $repo = new MysqlQuotaRepository($contextMock);
     $id = -1;
     $this->setExpectedException('Exception');
     $repo->deleteById($id);
 }
Exemple #7
0
 public function testIgnoreRemainingThrowsAnErrorWithTrailingParameters()
 {
     $mock = Phake::mock('PhakeTest_MockedClass');
     $mock->fooWithLotsOfParameters(3, 2, 1);
     $this->setExpectedException('InvalidArgumentException', 'Other matchers cannot be checked after you ignore remaining parameters.');
     Phake::verify($mock)->fooWithLotsOfParameters(Phake::ignoreRemaining(), 1);
 }
 /**
  * Test checkAccount method with bad account name.
  *
  * @expectedException SecretSales\Bundle\TestBundle\Exception\AccountNameNotFoundException
  * @expectedExceptionMessage Wrong account name ! Please verify if the account name "testBadAccountName" exist
  */
 public function testCheckAccountWithBadAccountName()
 {
     $fixtures = new TwitterResponseFixtures();
     \Phake::when($this->twitterOauth)->get('users/show', \Phake::ignoreRemaining())->thenReturn($fixtures->getFixtureErrorObject());
     $this->twitterProvider->checkAccount('testBadAccountName');
 }