added tests
This commit is contained in:
		
							parent
							
								
									5f96d8bc48
								
							
						
					
					
						commit
						73ac9315e7
					
				
							
								
								
									
										20
									
								
								tests/DBTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								tests/DBTest.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					use crodas\InfluxPHP\Client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class DBTest extends \phpunit_framework_testcase
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function testCreate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $client = new Client;
 | 
				
			||||||
 | 
					        return $client->createDatabase("test_foobar");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     *  @expectedException RuntimeException
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function testCreateException()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $client = new Client;
 | 
				
			||||||
 | 
					        return $client->createDatabase("test_foobar");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								tests/bootstrap.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tests/bootstrap.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require __DIR__ . "/../vendor/autoload.php";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$client = new \crodas\InfluxPHP\Client;
 | 
				
			||||||
 | 
					foreach ($client->getDatabases() as $db) {
 | 
				
			||||||
 | 
					    if (preg_match("/^test_/", $db->getName())) {
 | 
				
			||||||
 | 
					        $db->drop();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user