public function test_migrate_manager_trigger() { $this->setExpectedException('Doctrine\\DBAL\\DBALException'); $model = new MockModel($this->db); $mock_migrator = $this->getMockBuilder('SlimModel\\Event\\MigrateManager')->setMethods(["onSchemaException"])->getMock(); $mock_migrator->expects($this->once())->method('onSchemaException')->with($this->isInstanceOf("SlimModel\\Event\\ModelEventArgs")); $model->migrateManager = $mock_migrator; $model->insert(["title" => "Hello World"]); }
public function test_delete() { $model = new MockModel($this->db); $result = $model->insert(["title" => "Hello World"]); $this->assertEquals($result, 1); $model2 = new MockModel($this->db); $result2 = $model2->delete(["id" => 1]); $this->assertEquals($result2, 1); $model3 = new MockModel($this->db); $result3 = $model3->find(1); $this->assertFalse($result3); }