@@ -887,4 +887,70 @@ public function testBuildXmlWithWatcherAndUploadAndCustomFieldAndStandard()
887887 // Perform the tests
888888 $ api ->create ($ parameters );
889889 }
890+
891+ /**
892+ * Test assign an user to an issue
893+ *
894+ * @test
895+ */
896+ public function testAssignUserToAnIssue ()
897+ {
898+ // Test values
899+ $ parameters = [
900+ 'assigned_to_id ' => 5 ,
901+ ];
902+
903+ // Create the used mock objects
904+ $ client = $ this ->createMock (Client::class);
905+ $ client ->expects ($ this ->once ())
906+ ->method ('requestPut ' )
907+ ->with (
908+ '/issues/5.xml ' ,
909+ $ this ->logicalAnd (
910+ $ this ->stringStartsWith ('<?xml version="1.0"?> ' ."\n" .'<issue> ' ),
911+ $ this ->stringContains ('<assigned_to_id>5</assigned_to_id> ' ),
912+ $ this ->stringEndsWith ('</issue> ' ."\n" ),
913+
914+ )
915+ );
916+
917+ // Create the object under test
918+ $ api = new Issue ($ client );
919+
920+ // Perform the tests
921+ $ api ->update (5 , $ parameters );
922+ }
923+
924+ /**
925+ * Test unassign an user from an issue
926+ *
927+ * @test
928+ */
929+ public function testUnassignUserFromAnIssue ()
930+ {
931+ // Test values
932+ $ parameters = [
933+ 'assigned_to_id ' => "" ,
934+ ];
935+
936+ // Create the used mock objects
937+ $ client = $ this ->createMock (Client::class);
938+ $ client ->expects ($ this ->once ())
939+ ->method ('requestPut ' )
940+ ->with (
941+ '/issues/5.xml ' ,
942+ $ this ->logicalAnd (
943+ $ this ->stringStartsWith ('<?xml version="1.0"?> ' ."\n" .'<issue> ' ),
944+ $ this ->stringContains ('<assigned_to_id></assigned_to_id> ' ),
945+ $ this ->stringEndsWith ('</issue> ' ."\n" ),
946+
947+ )
948+ );
949+
950+ // Create the object under test
951+ $ api = new Issue ($ client );
952+
953+ // Perform the tests
954+ $ api ->update (5 , $ parameters );
955+ }
890956}
0 commit comments