@Before protected void setUp() throws Exception { super.setUp(); factory = SymfonyDbFactory.getInstance(); assertNotNull(factory); connection = factory.createConnection(); assertNotNull(connection); serviceDao = factory.getServiceDao(); assertNotNull(serviceDao); serviceDao.truncate(); }
@Test public void test() { try { serviceDao.insert("request", "Symfony\\Request\\Request", "true", null, "/foo/bar", 0); serviceDao.insert("many", "Symfony\\Doctrine\\ORM\\ManyToOne", "true", null, "/moo/lar", 0); serviceDao.insert("kernel", "Symfony\\Http\\Kernel", "false", null, "/sy/ror", 0); serviceDao.commitInsertions(); connection.commit(); final Stack<Service> services = new Stack<Service>(); serviceDao.findAll( new IServiceHandler() { @Override public void handle( String id, String phpClass, String path, String _public, String tags) { Service s = new Service(id, phpClass, path); s.setPublic(_public); s.setTags(tags); services.add(s); } }); assertEquals(3, services.size()); Service service = serviceDao.find("request"); assertNotNull(service); assertEquals("request", service.id); assertEquals("/foo/bar", service.path); assertEquals("Symfony\\Request\\Request", service.phpClass); } catch (Exception e) { e.printStackTrace(); fail(); } }