Guest User

Untitled

a guest
Mar 4th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. ## Test
  2. <?php
  3. require_once dirname(__FILE__) . '/../test_helper.php';
  4. require_once MODEL_PATH . '/user.php';
  5.  
  6. class UserTest extends UnitTestCase {
  7.  
  8. function setUp(){
  9. $q = new Doctrine_RawSql();
  10. $q->parseQuery('delete from users');
  11. $q->execute();
  12. }
  13.  
  14. function testShouldCreateUser(){
  15. $user = new User;
  16. $user->login = 'bobby';
  17. $user->password = 'test';
  18. $id = $user->save();
  19. $this->assertTrue($id);
  20. }
  21. }
  22.  
  23. $test = &new UserTest();
  24. $test->run(new TestReporter());
  25. ?>
  26.  
  27. ## Output
  28. UserTest
  29. Exception 1!
  30. Unexpected exception of type [Doctrine_Connection_Mysql_Exception] with message [SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM users' at line 1] in [/Users/jmartin/Projects/vaga/vendor/doctrine/lib/Doctrine/Connection.php line 867]
  31. FAILURES!!!
  32. Test cases run: 1/1, Passes: 0, Failures: 0, Exceptions: 1
Add Comment
Please, Sign In to add comment